generated from ydataai/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring: session, models/tokens, oidc, ctrl
- Loading branch information
Showing
10 changed files
with
291 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
package models | ||
|
||
import "golang.org/x/oauth2" | ||
import ( | ||
"encoding/json" | ||
|
||
"github.com/coreos/go-oidc/v3/oidc" | ||
"github.com/golang-jwt/jwt/v4" | ||
"golang.org/x/oauth2" | ||
) | ||
|
||
// Tokens defines the token struct | ||
type Tokens struct { | ||
OAuth2Token *oauth2.Token | ||
CustomClaims CustomClaims | ||
OAuth2Token *oauth2.Token | ||
IDTokenClaims *json.RawMessage | ||
UserInfo *oidc.UserInfo | ||
CustomClaims CustomClaims | ||
} | ||
|
||
// CustomClaims defines the custom claims struct | ||
type CustomClaims struct { | ||
Name string `json:"name"` | ||
Email string `json:"email"` | ||
EmailVerified bool `json:"email_verified" default:"false"` | ||
Picture string `json:"picture"` | ||
Expiry int64 `json:"exp"` | ||
IssuedAt int64 `json:"iat"` | ||
AccessToken string `json:"access_token,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Email string `json:"email,omitempty"` | ||
EmailVerified bool `json:"email_verified,omitempty" default:"false"` | ||
Picture string `json:"picture,omitempty"` | ||
Profile string `json:"profile,omitempty"` | ||
// The "aud" (audience) claim identifies the recipients that the JWT is intended for. | ||
// See more at: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 | ||
Audience string `json:"aud,omitempty"` | ||
// The "sub" (subject) claim identifies the principal that is the subject of the JWT. | ||
// See more at: https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 | ||
Subject string `json:"sub,omitempty"` | ||
// RegisteredClaims are a structured version of the JWT Claims Set, | ||
// restricted to Registered Claim Names, as referenced at | ||
// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 | ||
jwt.RegisteredClaims | ||
} |
Oops, something went wrong.