mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
b4e570358e
* build: include major in go.mod module directive * fix: xflags * revert: cobra changes * fix: mock doc
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package handlers
|
|
|
|
import (
|
|
"github.com/ory/fosite/handler/openid"
|
|
"github.com/ory/fosite/token/jwt"
|
|
|
|
"github.com/authelia/authelia/v4/internal/oidc"
|
|
"github.com/authelia/authelia/v4/internal/session"
|
|
"github.com/authelia/authelia/v4/internal/utils"
|
|
)
|
|
|
|
// isConsentMissing compares the requestedScopes and requestedAudience to the workflows
|
|
// GrantedScopes and GrantedAudience and returns true if they do not match or the workflow is nil.
|
|
func isConsentMissing(workflow *session.OIDCWorkflowSession, requestedScopes, requestedAudience []string) (isMissing bool) {
|
|
if workflow == nil {
|
|
return true
|
|
}
|
|
|
|
return len(requestedScopes) > 0 && utils.IsStringSlicesDifferent(requestedScopes, workflow.GrantedScopes) ||
|
|
len(requestedAudience) > 0 && utils.IsStringSlicesDifferentFold(requestedAudience, workflow.GrantedAudience)
|
|
}
|
|
|
|
func newOpenIDSession(subject string) *oidc.OpenIDSession {
|
|
return &oidc.OpenIDSession{
|
|
DefaultSession: &openid.DefaultSession{
|
|
Claims: new(jwt.IDTokenClaims),
|
|
Headers: new(jwt.Headers),
|
|
Subject: subject,
|
|
},
|
|
Extra: map[string]interface{}{},
|
|
}
|
|
}
|