Skip to content

Commit

Permalink
Fix domain information is up to date check (#2754)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsmaycon authored Oct 17, 2024
1 parent 96d2207 commit ccd4ae6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions management/server/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ import (
)

const (
PublicCategory = "public"
PrivateCategory = "private"
UnknownCategory = "unknown"
CacheExpirationMax = 7 * 24 * 3600 * time.Second // 7 days
CacheExpirationMin = 3 * 24 * 3600 * time.Second // 3 days
DefaultPeerLoginExpiration = 24 * time.Hour
PublicCategory = "public"
PrivateCategory = "private"
UnknownCategory = "unknown"
CacheExpirationMax = 7 * 24 * 3600 * time.Second // 7 days
CacheExpirationMin = 3 * 24 * 3600 * time.Second // 3 days
DefaultPeerLoginExpiration = 24 * time.Hour
DefaultPeerInactivityExpiration = 10 * time.Minute
emptyUserID = "empty user ID in claims"
errorGettingDomainAccIDFmt = "error getting account ID by private domain: %v"
emptyUserID = "empty user ID in claims"
errorGettingDomainAccIDFmt = "error getting account ID by private domain: %v"
)

type userLoggedInOnce bool
Expand Down Expand Up @@ -1440,7 +1440,7 @@ func (am *DefaultAccountManager) addAccountIDToIDPAppMeta(ctx context.Context, u
return err
}
cachedAccount := &Account{
Id: accountID,
Id: accountID,
Users: make(map[string]*User),
}
for _, user := range accountUsers {
Expand Down Expand Up @@ -2276,7 +2276,7 @@ func handleNotFound(err error) error {
}

func domainIsUpToDate(domain string, domainCategory string, claims jwtclaims.AuthorizationClaims) bool {
return claims.Domain != "" && claims.Domain != domain && claims.DomainCategory == PrivateCategory && domainCategory != PrivateCategory
return domainCategory == PrivateCategory || claims.DomainCategory != PrivateCategory || domain != claims.Domain
}

func (am *DefaultAccountManager) SyncAndMarkPeer(ctx context.Context, accountID string, peerPubKey string, meta nbpeer.PeerSystemMeta, realIP net.IP) (*nbpeer.Peer, *NetworkMap, []*posture.Checks, error) {
Expand Down

0 comments on commit ccd4ae6

Please sign in to comment.