-
Notifications
You must be signed in to change notification settings - Fork 24
feat(sdk): public client and other enhancements to well-known SDK functionality #1365
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
24 commits
Select commit
Hold shift + click to select a range
8faed6e
new proto accessors for idp well-known info on SDK
jakedoublev 709d197
remove condition no longer true since tokenEndpoint can be fetched fr…
jakedoublev 63ae9c0
add public client to keycloak_data.yaml
jakedoublev 4e71ac0
clean up keycloak provisioning
jakedoublev 7cb6ec9
WIP
jakedoublev 1f0fec1
set public_client_id from config to idp well-known configuration and …
jakedoublev c8b7549
handle access token source in separate PR
jakedoublev 3f29f20
Merge branch 'main' into feat/cli-auth
jakedoublev 2d18f54
lint
jakedoublev ace5c4f
lint
jakedoublev 1ffe6d4
Merge branch 'main' into feat/cli-auth
jakedoublev 4201591
Merge branch 'main' into feat/cli-auth
jakedoublev debcdbc
put back platform_issuer to avoid breaking java sdk
jakedoublev 012cf09
expose idp accessors of well-known off platform config rather than to…
jakedoublev 505671d
put back token_endpoint fetching if not provided
jakedoublev 1d6ebb1
add comment
jakedoublev 0d841be
use underscores for public_client_id in config
jakedoublev e667fbd
Merge branch 'main' into feat/cli-auth
jakedoublev a6a0c7c
use deprecated variable name
jakedoublev e66964f
comment for redirect uri usage
jakedoublev 3371f23
cleanup
jakedoublev 45130df
put back lib/fixtures
jakedoublev a58a2c0
Merge branch 'main' into feat/cli-auth
jakedoublev b729e00
yaml fmt
jakedoublev 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
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 |
|---|---|---|
| @@ -1,19 +1,54 @@ | ||
| package sdk | ||
|
|
||
| import "log/slog" | ||
| import ( | ||
| "log/slog" | ||
| ) | ||
|
|
||
| func (s SDK) PlatformIssuer() string { | ||
| // This check is needed if we want to fetch platform configuration over ipc | ||
| if s.config.platformConfiguration == nil { | ||
| cfg, err := getPlatformConfiguration(s.conn) | ||
| if err != nil { | ||
| slog.Warn("failed to get platform configuration", slog.Any("error", err)) | ||
| } | ||
| s.config.platformConfiguration = cfg | ||
| func (c PlatformConfiguration) getIdpConfig() map[string]interface{} { | ||
| idpCfg, err := c["idp"].(map[string]interface{}) | ||
| if !err { | ||
| slog.Warn("idp configuration not found in well-known configuration") | ||
| idpCfg = map[string]interface{}{} | ||
| } | ||
| value, ok := s.config.platformConfiguration["platform_issuer"].(string) | ||
| return idpCfg | ||
| } | ||
|
|
||
| func (c PlatformConfiguration) Issuer() (string, error) { | ||
| idpCfg := c.getIdpConfig() | ||
| value, ok := idpCfg["issuer"].(string) | ||
| if !ok { | ||
| slog.Warn("issuer not found in well-known idp configuration") | ||
| return "", ErrPlatformIssuerNotFound | ||
| } | ||
| return value, nil | ||
| } | ||
|
|
||
| func (c PlatformConfiguration) AuthzEndpoint() (string, error) { | ||
| idpCfg := c.getIdpConfig() | ||
| value, ok := idpCfg["authorization_endpoint"].(string) | ||
| if !ok { | ||
| slog.Warn("authorization_endpoint not found in well-known idp configuration") | ||
| return "", ErrPlatformAuthzEndpointNotFound | ||
| } | ||
| return value, nil | ||
| } | ||
|
|
||
| func (c PlatformConfiguration) TokenEndpoint() (string, error) { | ||
| idpCfg := c.getIdpConfig() | ||
| value, ok := idpCfg["token_endpoint"].(string) | ||
| if !ok { | ||
| slog.Warn("token_endpoint not found in well-known idp configuration") | ||
| return "", ErrPlatformTokenEndpointNotFound | ||
| } | ||
| return value, nil | ||
| } | ||
|
|
||
| func (c PlatformConfiguration) PublicClientID() (string, error) { | ||
| idpCfg := c.getIdpConfig() | ||
| value, ok := idpCfg["public_client_id"].(string) | ||
| if !ok { | ||
| slog.Warn("platform_issuer not found in platform configuration") | ||
| slog.Warn("public_client_id not found in well-known idp configuration") | ||
| return "", ErrPlatformTokenEndpointNotFound | ||
| } | ||
| return value | ||
| return value, nil | ||
| } |
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
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.