chore: Little fixes for OAuth2 login
This commit is contained in:
parent
f33ccbd2fa
commit
7f1e509e12
|
|
@ -214,6 +214,7 @@ func parseJwt(cfg *config.Config, token string) *authTypes.AuthenticatedUser {
|
||||||
user := &authTypes.AuthenticatedUser{
|
user := &authTypes.AuthenticatedUser{
|
||||||
Username: lookupClaimValueOrDefault(claims, cfg.AuthJwtClaimUsername, ""),
|
Username: lookupClaimValueOrDefault(claims, cfg.AuthJwtClaimUsername, ""),
|
||||||
UsergroupLine: parseGroupClaim(cfg.AuthJwtClaimUserGroup, claims),
|
UsergroupLine: parseGroupClaim(cfg.AuthJwtClaimUserGroup, claims),
|
||||||
|
Provider: "jwt",
|
||||||
}
|
}
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func generateRSAKeyPair(t *testing.T) (*rsa.PrivateKey, []byte) {
|
||||||
|
|
||||||
pubPem := pem.EncodeToMemory(
|
pubPem := pem.EncodeToMemory(
|
||||||
&pem.Block{
|
&pem.Block{
|
||||||
Type: "RSA PUBLIC KEY",
|
Type: "PUBLIC KEY",
|
||||||
Bytes: pkixPubKey,
|
Bytes: pkixPubKey,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ var oauth2ProviderDatabase = map[string]config.OAuth2Provider{
|
||||||
Title: "Google",
|
Title: "Google",
|
||||||
Name: "google",
|
Name: "google",
|
||||||
Icon: "google",
|
Icon: "google",
|
||||||
UsernameField: "preferred_username",
|
UsernameField: "email",
|
||||||
WhoamiUrl: "https://www.googleapis.com/oauth2/v3/userinfo",
|
WhoamiUrl: "https://www.googleapis.com/oauth2/v3/userinfo",
|
||||||
TokenUrl: endpoints.Google.TokenURL,
|
TokenUrl: endpoints.Google.TokenURL,
|
||||||
AuthUrl: endpoints.Google.AuthURL,
|
AuthUrl: endpoints.Google.AuthURL,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue