zitadel/internal/api/ui/login/policy_handler.go
Livio Spring 48f9815b7c
feat(login): use new IDP templates (#5315)
The login uses the new template based IDPs with backwards compatibility for old IDPs
2023-02-28 21:20:58 +01:00

37 lines
1.1 KiB
Go

package login
import (
"net/http"
"github.com/zitadel/zitadel/internal/query"
)
func (l *Login) getDefaultDomainPolicy(r *http.Request) (*query.DomainPolicy, error) {
return l.query.DefaultDomainPolicy(r.Context())
}
func (l *Login) getOrgDomainPolicy(r *http.Request, orgID string) (*query.DomainPolicy, error) {
if orgID == "" {
return l.query.DefaultDomainPolicy(r.Context())
}
return l.query.DomainPolicyByOrg(r.Context(), false, orgID, false)
}
func (l *Login) getIDPByID(r *http.Request, id string) (*query.IDPTemplate, error) {
return l.query.IDPTemplateByID(r.Context(), false, id, false)
}
func (l *Login) getLoginPolicy(r *http.Request, orgID string) (*query.LoginPolicy, error) {
if orgID == "" {
return l.query.DefaultLoginPolicy(r.Context())
}
return l.query.LoginPolicyByID(r.Context(), false, orgID, false)
}
func (l *Login) getLabelPolicy(r *http.Request, orgID string) (*query.LabelPolicy, error) {
if orgID == "" {
return l.query.DefaultActiveLabelPolicy(r.Context())
}
return l.query.ActiveLabelPolicyByOrg(r.Context(), orgID, false)
}