fix: removeUserinfoScopes return new slice (without manipulating passed one) (#110)
This commit is contained in:
parent
8a35b89815
commit
1132c9d93d
1 changed files with 10 additions and 9 deletions
|
@ -155,15 +155,16 @@ func CreateIDToken(ctx context.Context, issuer string, request IDTokenRequest, v
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeUserinfoScopes(scopes []string) []string {
|
func removeUserinfoScopes(scopes []string) []string {
|
||||||
for i := len(scopes) - 1; i >= 0; i-- {
|
newScopeList := make([]string, 0, len(scopes))
|
||||||
if scopes[i] == oidc.ScopeProfile ||
|
for _, scope := range scopes {
|
||||||
scopes[i] == oidc.ScopeEmail ||
|
switch scope {
|
||||||
scopes[i] == oidc.ScopeAddress ||
|
case oidc.ScopeProfile,
|
||||||
scopes[i] == oidc.ScopePhone {
|
oidc.ScopeEmail,
|
||||||
|
oidc.ScopeAddress,
|
||||||
scopes[i] = scopes[len(scopes)-1]
|
oidc.ScopePhone:
|
||||||
scopes[len(scopes)-1] = ""
|
continue
|
||||||
scopes = scopes[:len(scopes)-1]
|
default:
|
||||||
|
newScopeList = append(newScopeList, scope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return scopes
|
return scopes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue