Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change sub type of IntrospectTokenResult to string #123

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading