Skip to content

Commit

Permalink
feat: change sub type of IntrospectTokenResult to string (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
notdu authored Aug 15, 2024
1 parent 1eca82d commit 64803a4
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions casdoorsdk/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"errors"
"fmt"
"strconv"

"github.com/google/uuid"
)

// Token has the same definition as https://github.com/casdoor/casdoor/blob/master/object/token.go#L45
Expand All @@ -44,18 +42,18 @@ type Token struct {
CodeExpireIn int64 `json:"codeExpireIn"`
}

type IntroSpectTokenResult struct {
Active bool `json:"active"`
ClientId string `json:"client_id"`
Username string `json:"username"`
TokenType string `json:"token_type"`
Exp uint `json:"exp"`
Iat uint `json:"iat"`
Nbf uint `json:"nbf"`
Sub uuid.UUID `json:"sub"`
Aud []string `json:"aud"`
Iss string `json:"iss"`
Jti string `json:"jti"`
type IntrospectTokenResult struct {
Active bool `json:"active"`
ClientId string `json:"client_id"`
Username string `json:"username"`
TokenType string `json:"token_type"`
Exp uint `json:"exp"`
Iat uint `json:"iat"`
Nbf uint `json:"nbf"`
Sub string `json:"sub"`
Aud []string `json:"aud"`
Iss string `json:"iss"`
Jti string `json:"jti"`
}

func (c *Client) GetTokens() ([]*Token, error) {
Expand Down Expand Up @@ -144,7 +142,7 @@ func (c *Client) DeleteToken(token *Token) (bool, error) {
return affected, err
}

func (c *Client) IntrospectToken(token, tokenTypeHint string) (result *IntroSpectTokenResult, err error) {
func (c *Client) IntrospectToken(token, tokenTypeHint string) (result *IntrospectTokenResult, err error) {
queryMap := map[string]string{
"token": token,
"token_type_hint": tokenTypeHint,
Expand Down

0 comments on commit 64803a4

Please sign in to comment.