mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-14 12:26:34 +00:00
28 lines
537 B
Go
28 lines
537 B
Go
package acr
|
|
|
|
import (
|
|
"github.com/nais/wonderwall/pkg/config"
|
|
"github.com/nais/wonderwall/pkg/openid/acr"
|
|
"github.com/nais/wonderwall/pkg/session"
|
|
)
|
|
|
|
type Handler struct {
|
|
Enabled bool
|
|
ExpectedValue string
|
|
}
|
|
|
|
func (h *Handler) Validate(sess *session.Session) error {
|
|
if !h.Enabled || sess == nil {
|
|
return nil
|
|
}
|
|
|
|
return acr.Validate(h.ExpectedValue, sess.Acr())
|
|
}
|
|
|
|
func NewHandler(cfg *config.Config) *Handler {
|
|
return &Handler{
|
|
Enabled: len(cfg.OpenID.ACRValues) > 0,
|
|
ExpectedValue: cfg.OpenID.ACRValues,
|
|
}
|
|
}
|