mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-15 23:23:50 +08:00
feat: use token's client ID instead in IntrospectToken() API (#3948)
This commit is contained in:
@ -16,6 +16,7 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/beego/beego/utils/pagination"
|
"github.com/beego/beego/utils/pagination"
|
||||||
@ -460,7 +461,18 @@ func (c *ApiController) IntrospectToken() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if token != nil {
|
if token != nil {
|
||||||
|
application, err = object.GetApplication(fmt.Sprintf("%s/%s", token.Owner, token.Application))
|
||||||
|
if err != nil {
|
||||||
|
c.ResponseTokenError(err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if application == nil {
|
||||||
|
c.ResponseError(fmt.Sprintf(c.T("auth:The application: %s does not exist"), token.Application))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
introspectionResponse.TokenType = token.TokenType
|
introspectionResponse.TokenType = token.TokenType
|
||||||
|
introspectionResponse.ClientId = application.ClientId
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = introspectionResponse
|
c.Data["json"] = introspectionResponse
|
||||||
|
Reference in New Issue
Block a user