Documentation
¶
Index ¶
- Constants
- func FetchAndParseMetadata(ctx context.Context, tenantID string, metadataURL string, ...) (*saml.EntityDescriptor, string, error)
- func FormatCertificate(rawCert string) string
- func MapClaims(subject string, contextMap map[string]interface{}, ...) map[string]interface{}
- func ProjectNormalizedIdentityClaims(loginReq *model.LoginRequest) (map[string]interface{}, bool)
- func ProjectNormalizedSAMLAttributes(loginReq *model.LoginRequest) (map[string]interface{}, bool)
- func SeedSystemScopesForTenant(ctx context.Context, repo port.ScopeRepository, tenantID string) error
- type DefaultKeyManager
- func (km *DefaultKeyManager) GetActiveKeys(ctx context.Context, use string) (*rsa.PrivateKey, *x509.Certificate, string, error)
- func (km *DefaultKeyManager) GetActivePrivateKey(ctx context.Context, use string) (*rsa.PrivateKey, string, error)
- func (km *DefaultKeyManager) GetDecryptionKeys(ctx context.Context) (map[string]*rsa.PrivateKey, error)
- func (km *DefaultKeyManager) GetPublicJWKS(ctx context.Context) (*jose.JSONWebKeySet, error)
- func (km *DefaultKeyManager) ImportKey(ctx context.Context, use string, privKey *rsa.PrivateKey, certPEM []byte) (*model.CryptoKey, error)
- func (km *DefaultKeyManager) RotateKeys(ctx context.Context) error
- type JWKSCache
- type JWKSCacheOption
- func WithClock(clock func() time.Time) JWKSCacheOption
- func WithGracePeriod(grace time.Duration) JWKSCacheOption
- func WithHTTPClient(client *http.Client) JWKSCacheOption
- func WithJWKSURIValidator(validator func(context.Context, string) error) JWKSCacheOption
- func WithTTL(ttl time.Duration) JWKSCacheOption
- type KeyManager
- type Provider
Constants ¶
View Source
const ( RotationActiveTTL = 30 * 24 * time.Hour RotationPendingTTL = 1 * time.Hour RotationPassiveTTL = 24 * time.Hour )
View Source
const (
ContextKeyAllowPrivateJWKSIPs jwksContextKey = "allow_private_jwks_ips"
)
View Source
const SAMLNameIDSubjectAttribute = "__shyntr_saml_nameid_subject"
Variables ¶
This section is empty.
Functions ¶
func FetchAndParseMetadata ¶
func FetchAndParseMetadata( ctx context.Context, tenantID string, metadataURL string, outbound port.OutboundGuard, ) (*saml.EntityDescriptor, string, error)
func FormatCertificate ¶
func MapClaims ¶
func MapClaims(subject string, contextMap map[string]interface{}, grantedScopes []*model.Scope) map[string]interface{}
MapClaims filters the raw context map based on requested scopes and tenant context.
func ProjectNormalizedIdentityClaims ¶ added in v1.1.0
func ProjectNormalizedIdentityClaims(loginReq *model.LoginRequest) (map[string]interface{}, bool)
func ProjectNormalizedSAMLAttributes ¶ added in v1.1.0
func ProjectNormalizedSAMLAttributes(loginReq *model.LoginRequest) (map[string]interface{}, bool)
ProjectNormalizedSAMLAttributes returns the conservative SAML projection for a persisted normalized login context.
Types ¶
type DefaultKeyManager ¶
type DefaultKeyManager struct {
// contains filtered or unexported fields
}
func (*DefaultKeyManager) GetActiveKeys ¶
func (km *DefaultKeyManager) GetActiveKeys(ctx context.Context, use string) (*rsa.PrivateKey, *x509.Certificate, string, error)
func (*DefaultKeyManager) GetActivePrivateKey ¶
func (km *DefaultKeyManager) GetActivePrivateKey(ctx context.Context, use string) (*rsa.PrivateKey, string, error)
func (*DefaultKeyManager) GetDecryptionKeys ¶
func (km *DefaultKeyManager) GetDecryptionKeys(ctx context.Context) (map[string]*rsa.PrivateKey, error)
func (*DefaultKeyManager) GetPublicJWKS ¶
func (km *DefaultKeyManager) GetPublicJWKS(ctx context.Context) (*jose.JSONWebKeySet, error)
func (*DefaultKeyManager) ImportKey ¶
func (km *DefaultKeyManager) ImportKey(ctx context.Context, use string, privKey *rsa.PrivateKey, certPEM []byte) (*model.CryptoKey, error)
func (*DefaultKeyManager) RotateKeys ¶
func (km *DefaultKeyManager) RotateKeys(ctx context.Context) error
type JWKSCache ¶
type JWKSCache struct {
// contains filtered or unexported fields
}
func NewJWKSCache ¶
func NewJWKSCache(opts ...JWKSCacheOption) *JWKSCache
type JWKSCacheOption ¶
type JWKSCacheOption func(*JWKSCache)
func WithClock ¶
func WithClock(clock func() time.Time) JWKSCacheOption
func WithGracePeriod ¶
func WithGracePeriod(grace time.Duration) JWKSCacheOption
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) JWKSCacheOption
func WithJWKSURIValidator ¶
func WithJWKSURIValidator(validator func(context.Context, string) error) JWKSCacheOption
func WithTTL ¶
func WithTTL(ttl time.Duration) JWKSCacheOption
type KeyManager ¶
type KeyManager interface {
GetActivePrivateKey(ctx context.Context, use string) (*rsa.PrivateKey, string, error)
GetDecryptionKeys(ctx context.Context) (map[string]*rsa.PrivateKey, error)
GetPublicJWKS(ctx context.Context) (*jose.JSONWebKeySet, error)
GetActiveKeys(ctx context.Context, use string) (*rsa.PrivateKey, *x509.Certificate, string, error)
RotateKeys(ctx context.Context) error
ImportKey(ctx context.Context, use string, privKey *rsa.PrivateKey, certPEM []byte) (*model.CryptoKey, error)
}
func NewKeyManager ¶
func NewKeyManager(repo port.CryptoKeyRepository, cfg *config.Config) KeyManager
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(db *gorm.DB, baseConfig *fosite.Config, km KeyManager, clientRepo port.OAuth2ClientRepository, jtiRepo port.BlacklistedJTIRepository) *Provider
Click to show internal directories.
Click to hide internal directories.