auth: Use context from request
This commit is contained in:
parent
22638dcc51
commit
98df8b4d94
@ -88,7 +88,7 @@ func OIDC_CRI_complete(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
oauth2Token, err := oauth2Config.Exchange(context.Background(), c.Request.URL.Query().Get("code"))
|
oauth2Token, err := oauth2Config.Exchange(c.Request.Context(), c.Request.URL.Query().Get("code"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Failed to exchange token: " + err.Error()})
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Failed to exchange token: " + err.Error()})
|
||||||
return
|
return
|
||||||
@ -98,7 +98,7 @@ func OIDC_CRI_complete(c *gin.Context) {
|
|||||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "No id_token field in oauth2 token."})
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "No id_token field in oauth2 token."})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
idToken, err := oidcVerifier.Verify(context.Background(), rawIDToken)
|
idToken, err := oidcVerifier.Verify(c.Request.Context(), rawIDToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Failed to verify ID Token: " + err.Error()})
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": "Failed to verify ID Token: " + err.Error()})
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user