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
34 lines
980 B
Go
34 lines
980 B
Go
package handlers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/authelia/authelia/v4/internal/session"
|
|
)
|
|
|
|
func TestShouldDetectIfConsentIsMissing(t *testing.T) {
|
|
var workflow *session.OIDCWorkflowSession
|
|
|
|
requestedScopes := []string{"openid", "profile"}
|
|
requestedAudience := []string{"https://authelia.com"}
|
|
|
|
assert.True(t, isConsentMissing(workflow, requestedScopes, requestedAudience))
|
|
|
|
workflow = &session.OIDCWorkflowSession{
|
|
GrantedScopes: []string{"openid", "profile"},
|
|
GrantedAudience: []string{"https://authelia.com"},
|
|
}
|
|
|
|
assert.False(t, isConsentMissing(workflow, requestedScopes, requestedAudience))
|
|
|
|
requestedScopes = []string{"openid", "profile", "group"}
|
|
|
|
assert.True(t, isConsentMissing(workflow, requestedScopes, requestedAudience))
|
|
|
|
requestedScopes = []string{"openid", "profile"}
|
|
requestedAudience = []string{"https://not.authelia.com"}
|
|
assert.True(t, isConsentMissing(workflow, requestedScopes, requestedAudience))
|
|
}
|