feat: add OIDC feature support. (#373)

1. add nonce parameter.
2. add sub in userinfo endpoint.

Signed-off-by: 0x2a <stevesough@gmail.com>
This commit is contained in:
Steve0x2a
2021-12-15 21:42:16 +08:00
committed by GitHub
parent 370e835499
commit 98f6cc0085
7 changed files with 22 additions and 10 deletions

View File

@ -175,7 +175,7 @@ func CheckOAuthLogin(clientId string, responseType string, redirectUri string, s
return "", application
}
func GetOAuthCode(userId string, clientId string, responseType string, redirectUri string, scope string, state string) *Code {
func GetOAuthCode(userId string, clientId string, responseType string, redirectUri string, scope string, state string, nonce string) *Code {
user := GetUser(userId)
if user == nil {
return &Code{
@ -192,7 +192,7 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
}
}
accessToken, err := generateJwtToken(application, user)
accessToken, err := generateJwtToken(application, user, nonce)
if err != nil {
panic(err)
}