-
Notifications
You must be signed in to change notification settings - Fork 77
feat: add session-transfer delegation flags in apps (EA only) #1587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
393a122
feat(apps): add session-transfer delegation flags
bkiran6398 d3e447a
test(apps): revert integration test updates of delegation session-traβ¦
bkiran6398 d2b5da9
refactor(apps): address review on delegation flags
bkiran6398 cdd813c
docs(apps): mark delegation example as Early Access
bkiran6398 b84b5b1
Merge branch 'main' into DXCDT-1967/session-transfer-delegation
bkiran6398 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package display | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/auth0/go-auth0" | ||
| "github.com/auth0/go-auth0/management" | ||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestMakeSessionTransferView_WithoutDelegation(t *testing.T) { | ||
| client := &management.Client{ | ||
| ClientID: auth0.String("client-id"), | ||
| SessionTransfer: &management.SessionTransfer{ | ||
| CanCreateSessionTransferToken: auth0.Bool(true), | ||
| AllowedAuthenticationMethods: &[]string{"cookie", "query"}, | ||
| EnforceDeviceBinding: auth0.String("ip"), | ||
| }, | ||
| } | ||
|
|
||
| view := MakeSessionTransferView(client) | ||
|
|
||
| assert.False(t, view.hasDelegation) | ||
| assert.Equal(t, "", view.DelegationAllowAccess) | ||
| assert.Equal(t, "", view.DelegationDeviceBinding) | ||
|
|
||
| // Delegation rows must be omitted when no delegation is configured. | ||
| keyValues := view.KeyValues() | ||
| assert.Equal(t, [][]string{ | ||
| {"CLIENT ID", "client-id"}, | ||
| {"CAN CREATE TOKEN", boolean(true)}, | ||
| {"ALLOWED METHODS", "cookie, query"}, | ||
| {"DEVICE BINDING", "ip"}, | ||
| }, keyValues) | ||
| } | ||
|
|
||
| func TestMakeSessionTransferView_WithDelegation(t *testing.T) { | ||
| client := &management.Client{ | ||
| ClientID: auth0.String("client-id"), | ||
| SessionTransfer: &management.SessionTransfer{ | ||
| CanCreateSessionTransferToken: auth0.Bool(true), | ||
| AllowedAuthenticationMethods: &[]string{"cookie"}, | ||
| EnforceDeviceBinding: auth0.String("ip"), | ||
| Delegation: &management.SessionTransferDelegation{ | ||
| AllowDelegatedAccess: auth0.Bool(true), | ||
| EnforceDeviceBinding: auth0.String("asn"), | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| view := MakeSessionTransferView(client) | ||
|
|
||
| assert.True(t, view.hasDelegation) | ||
| assert.Equal(t, boolean(true), view.DelegationAllowAccess) | ||
| assert.Equal(t, "asn", view.DelegationDeviceBinding) | ||
|
|
||
| // Delegation rows must be appended after the base session-transfer rows. | ||
| keyValues := view.KeyValues() | ||
| assert.Equal(t, [][]string{ | ||
| {"CLIENT ID", "client-id"}, | ||
| {"CAN CREATE TOKEN", boolean(true)}, | ||
| {"ALLOWED METHODS", "cookie"}, | ||
| {"DEVICE BINDING", "ip"}, | ||
| {"ALLOW DELEGATED ACCESS", boolean(true)}, | ||
| {"DELEGATION DEVICE BINDING", "asn"}, | ||
| }, keyValues) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.