29 lines
658 B
Go
29 lines
658 B
Go
package claims
|
|
|
|
import "oc-auth/conf"
|
|
|
|
// Tokenizer interface
|
|
type ClaimService interface {
|
|
AddClaimsToToken(userId string, host string) Claims
|
|
DecodeClaimsInToken(host string, method string, forward string, sessionClaims Claims, publicKey string, external bool) (bool, error)
|
|
}
|
|
|
|
// SessionClaims struct
|
|
type SessionClaims struct {
|
|
AccessToken map[string]interface{} `json:"access_token"`
|
|
IDToken map[string]interface{} `json:"id_token"`
|
|
}
|
|
|
|
// Claims struct
|
|
type Claims struct {
|
|
Session SessionClaims `json:"session"`
|
|
}
|
|
|
|
var t = map[string]ClaimService{
|
|
"hydra": HydraClaims{},
|
|
}
|
|
|
|
func GetClaims() ClaimService {
|
|
return t[conf.GetConfig().Auth]
|
|
}
|