mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
feat: return most backend API errors to frontend (#1836)
* feat: return most backend API errros to frontend Signed-off-by: yehong <239859435@qq.com> * refactor: reduce int type change Signed-off-by: yehong <239859435@qq.com> * feat: return err backend in token.go Signed-off-by: yehong <239859435@qq.com> --------- Signed-off-by: yehong <239859435@qq.com>
This commit is contained in:
@ -273,7 +273,10 @@ func generateJwtToken(application *Application, user *User, nonce string, scope
|
||||
refreshToken = jwt.NewWithClaims(jwt.SigningMethodRS256, claimsWithoutThirdIdp)
|
||||
}
|
||||
|
||||
cert := getCertByApplication(application)
|
||||
cert, err := getCertByApplication(application)
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
// RSA private key
|
||||
key, err := jwt.ParseRSAPrivateKeyFromPEM([]byte(cert.PrivateKey))
|
||||
@ -316,5 +319,10 @@ func ParseJwtToken(token string, cert *Cert) (*Claims, error) {
|
||||
}
|
||||
|
||||
func ParseJwtTokenByApplication(token string, application *Application) (*Claims, error) {
|
||||
return ParseJwtToken(token, getCertByApplication(application))
|
||||
cert, err := getCertByApplication(application)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ParseJwtToken(token, cert)
|
||||
}
|
||||
|
Reference in New Issue
Block a user