Skip to content

Commit

Permalink
refactor(oauth): rename aad instance discovery endpoint const
Browse files Browse the repository at this point in the history
This enables adding the same const for dSTS later in the process.
  • Loading branch information
handsomejack-42 authored and bgavrilMS committed Nov 5, 2024
1 parent a9d2090 commit 328056f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/internal/oauth/ops/authority/authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

const (
authorizationEndpoint = "https://%v/%v/oauth2/v2.0/authorize"
instanceDiscoveryEndpoint = "https://%v/common/discovery/instance"
aadInstanceDiscoveryEndpoint = "https://%v/common/discovery/instance"
tenantDiscoveryEndpointWithRegion = "https://%s.%s/%s/v2.0/.well-known/openid-configuration"
regionName = "REGION_NAME"
defaultAPIVersion = "2021-10-01"
Expand Down Expand Up @@ -522,7 +522,7 @@ func (c Client) AADInstanceDiscovery(ctx context.Context, authorityInfo Info) (I
discoveryHost = authorityInfo.Host
}

endpoint := fmt.Sprintf(instanceDiscoveryEndpoint, discoveryHost)
endpoint := fmt.Sprintf(aadInstanceDiscoveryEndpoint, discoveryHost)
err = c.Comm.JSONCall(ctx, endpoint, http.Header{}, qv, nil, &resp)
}
return resp, err
Expand Down
4 changes: 2 additions & 2 deletions apps/internal/oauth/ops/authority/authority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func TestAADInstanceDiscovery(t *testing.T) {
},
{
desc: "Success with authorityInfo.Host not in trusted list",
endpoint: fmt.Sprintf(instanceDiscoveryEndpoint, defaultHost),
endpoint: fmt.Sprintf(aadInstanceDiscoveryEndpoint, defaultHost),
authInfo: Info{
Host: "host",
Tenant: "tenant",
Expand All @@ -227,7 +227,7 @@ func TestAADInstanceDiscovery(t *testing.T) {
},
{
desc: "Success with authorityInfo.Host in trusted list",
endpoint: fmt.Sprintf(instanceDiscoveryEndpoint, "login.microsoftonline.de"),
endpoint: fmt.Sprintf(aadInstanceDiscoveryEndpoint, "login.microsoftonline.de"),
authInfo: Info{
Host: "login.microsoftonline.de",
Tenant: "tenant",
Expand Down

0 comments on commit 328056f

Please sign in to comment.