Skip to content

Commit

Permalink
refactor(authority): use authority.ADFS instead of re-defined ADFS const
Browse files Browse the repository at this point in the history
  • Loading branch information
handsomejack-42 authored and bgavrilMS committed Nov 5, 2024
1 parent 80b1f35 commit 7999274
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions apps/internal/oauth/resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import (
"github.com/AzureAD/microsoft-authentication-library-for-go/apps/internal/oauth/ops/authority"
)

// ADFS is an active directory federation service authority type.
const ADFS = "ADFS"

type cacheEntry struct {
Endpoints authority.Endpoints
ValidForDomainsInList map[string]bool
Expand Down Expand Up @@ -83,7 +80,7 @@ func (m *authorityEndpoint) cachedEndpoints(authorityInfo authority.Info, userPr
defer m.mu.Unlock()

if cacheEntry, ok := m.cache[authorityInfo.CanonicalAuthorityURI]; ok {
if authorityInfo.AuthorityType == ADFS {
if authorityInfo.AuthorityType == authority.ADFS {
domain, err := adfsDomainFromUpn(userPrincipalName)
if err == nil {
if _, ok := cacheEntry.ValidForDomainsInList[domain]; ok {
Expand All @@ -102,7 +99,7 @@ func (m *authorityEndpoint) addCachedEndpoints(authorityInfo authority.Info, use

updatedCacheEntry := createcacheEntry(endpoints)

if authorityInfo.AuthorityType == ADFS {
if authorityInfo.AuthorityType == authority.ADFS {
// Since we're here, we've made a call to the backend. We want to ensure we're caching
// the latest values from the server.
if cacheEntry, ok := m.cache[authorityInfo.CanonicalAuthorityURI]; ok {
Expand Down

0 comments on commit 7999274

Please sign in to comment.