2024-10-28 14:58:11 +01:00
|
|
|
package claims
|
|
|
|
|
2024-10-30 12:38:25 +01:00
|
|
|
import "oc-auth/conf"
|
|
|
|
|
2024-10-28 14:58:11 +01:00
|
|
|
// Tokenizer interface
|
|
|
|
type ClaimService interface {
|
|
|
|
AddClaimsToToken(userId string, host string) Claims
|
2024-10-30 12:38:25 +01:00
|
|
|
DecodeClaimsInToken(host string, method string, forward string, sessionClaims Claims, publicKey string) (bool, error)
|
2024-10-28 14:58:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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"`
|
|
|
|
}
|
2024-10-30 12:38:25 +01:00
|
|
|
|
|
|
|
var t = map[string]ClaimService{
|
|
|
|
"hydra": HydraClaims{},
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetClaims() ClaimService {
|
|
|
|
return t[conf.GetConfig().Auth]
|
|
|
|
}
|