-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: set raw claims if they exist in authz metadata (#3125)
* chore: go mod tidy Signed-off-by: Mark Phelps <[email protected]> * chore: set raw claims if they exist in authz metadata Signed-off-by: Mark Phelps <[email protected]> * chore: fix authn oidc server test Signed-off-by: Mark Phelps <[email protected]> * chore: skip authz on auth public server Signed-off-by: Mark Phelps <[email protected]> * chore: log for debugging Signed-off-by: Mark Phelps <[email protected]> --------- Signed-off-by: Mark Phelps <[email protected]>
- Loading branch information
1 parent
fbd21f2
commit b15e83e
Showing
14 changed files
with
59 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package method | ||
|
||
const ( | ||
StorageMetadataRole = "io.flipt.auth.role" | ||
StorageMetadataEmail = "io.flipt.auth.email" | ||
StorageMetadataName = "io.flipt.auth.name" | ||
StorageMetadataClaims = "io.flipt.auth.claims" | ||
StorageMetadataEmail = "io.flipt.auth.email" | ||
StorageMetadataName = "io.flipt.auth.name" | ||
) |
This file contains 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 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 |
---|---|---|
|
@@ -109,11 +109,10 @@ func Test_Server_ImplicitFlow(t *testing.T) { | |
Method: config.AuthenticationMethodOIDCConfig{ | ||
Providers: map[string]config.AuthenticationMethodOIDCProvider{ | ||
"google": { | ||
IssuerURL: tp.Addr(), | ||
ClientID: id, | ||
ClientSecret: secret, | ||
RedirectAddress: clientAddress, | ||
RoleAttributePath: "contains(roles[*], 'admin') && 'admin' || contains(roles[*], 'editor') && 'editor' || 'viewer'", | ||
IssuerURL: tp.Addr(), | ||
ClientID: id, | ||
ClientSecret: secret, | ||
RedirectAddress: clientAddress, | ||
}, | ||
}, | ||
}, | ||
|
@@ -215,12 +214,11 @@ func Test_Server_PKCE(t *testing.T) { | |
Method: config.AuthenticationMethodOIDCConfig{ | ||
Providers: map[string]config.AuthenticationMethodOIDCProvider{ | ||
"google": { | ||
IssuerURL: tp.Addr(), | ||
ClientID: id, | ||
ClientSecret: secret, | ||
RedirectAddress: clientAddress, | ||
UsePKCE: true, | ||
RoleAttributePath: "contains(roles[*], 'admin') && 'admin' || contains(roles[*], 'editor') && 'editor' || 'viewer'", | ||
IssuerURL: tp.Addr(), | ||
ClientID: id, | ||
ClientSecret: secret, | ||
RedirectAddress: clientAddress, | ||
UsePKCE: true, | ||
}, | ||
}, | ||
}, | ||
|
@@ -346,15 +344,19 @@ func testOIDCFlow(t *testing.T, ctx context.Context, tpAddr, clientAddress strin | |
|
||
assert.Empty(t, response.ClientToken) // middleware moves it to cookie | ||
assert.Equal(t, auth.Method_METHOD_OIDC, response.Authentication.Method) | ||
assert.Equal(t, map[string]string{ | ||
|
||
for k, v := range map[string]string{ | ||
"io.flipt.auth.oidc.provider": "google", | ||
"io.flipt.auth.oidc.email": "[email protected]", | ||
"io.flipt.auth.email": "[email protected]", | ||
"io.flipt.auth.oidc.name": "Mark Phelps", | ||
"io.flipt.auth.name": "Mark Phelps", | ||
"io.flipt.auth.oidc.sub": "mark", | ||
"io.flipt.auth.role": "admin", | ||
}, response.Authentication.Metadata) | ||
} { | ||
assert.Equal(t, v, response.Authentication.Metadata[k]) | ||
} | ||
|
||
assert.NotEmpty(t, response.Authentication.Metadata["io.flipt.auth.claims"]) | ||
|
||
// ensure expiry is set | ||
assert.NotNil(t, response.Authentication.ExpiresAt) | ||
|
This file contains 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 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 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.