fieldalignment of all structs to save memory
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -12,11 +12,10 @@ import (
|
||||
|
||||
// authClaims to be encoded in the JWT
|
||||
type authClaims struct {
|
||||
Type string `json:"type"`
|
||||
Scopes []string `json:"scopes"`
|
||||
Metadata metadata.Metadata `json:"metadata"`
|
||||
|
||||
jwt.StandardClaims
|
||||
Type string `json:"type"`
|
||||
Scopes []string `json:"scopes"`
|
||||
}
|
||||
|
||||
// JWT implementation of token provider
|
||||
@@ -51,7 +50,7 @@ func (j *JWT) Generate(acc *auth.Account, opts ...token.GenerateOption) (*token.
|
||||
// generate the JWT
|
||||
expiry := time.Now().Add(options.Expiry)
|
||||
t := jwt.NewWithClaims(jwt.SigningMethodRS256, authClaims{
|
||||
acc.Type, acc.Scopes, acc.Metadata, jwt.StandardClaims{
|
||||
Type: acc.Type, Scopes: acc.Scopes, Metadata: acc.Metadata, StandardClaims: jwt.StandardClaims{
|
||||
Subject: acc.ID,
|
||||
Issuer: acc.Issuer,
|
||||
ExpiresAt: expiry.Unix(),
|
||||
|
@@ -25,10 +25,10 @@ type Provider interface {
|
||||
|
||||
// Token holds the auth token
|
||||
type Token struct {
|
||||
// The actual token
|
||||
Token string `json:"token"`
|
||||
// Time of token creation
|
||||
// Created time of token created
|
||||
Created time.Time `json:"created"`
|
||||
// Time of token expiry
|
||||
// Expiry ime of the token
|
||||
Expiry time.Time `json:"expiry"`
|
||||
// Token holds the actual token
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user