2021-02-08 10:30:30 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
const (
|
|
|
|
OrgDomainPrimaryScope = "urn:zitadel:iam:org:domain:primary:"
|
2022-09-23 12:08:10 +00:00
|
|
|
OrgIDScope = "urn:zitadel:iam:org:id:"
|
2021-02-08 10:30:30 +00:00
|
|
|
OrgDomainPrimaryClaim = "urn:zitadel:iam:org:domain:primary"
|
2022-09-23 12:08:10 +00:00
|
|
|
OrgIDClaim = "urn:zitadel:iam:org:id"
|
2021-02-08 10:30:30 +00:00
|
|
|
ProjectIDScope = "urn:zitadel:iam:org:project:id:"
|
2022-08-09 07:45:59 +00:00
|
|
|
ProjectIDScopeZITADEL = "zitadel"
|
2021-02-08 10:30:30 +00:00
|
|
|
AudSuffix = ":aud"
|
2022-03-31 09:36:26 +00:00
|
|
|
SelectIDPScope = "urn:zitadel:iam:org:idp:id:"
|
2021-02-08 10:30:30 +00:00
|
|
|
)
|
|
|
|
|
2022-10-20 12:36:52 +00:00
|
|
|
// TODO: Change AuthRequest to interface and let oidcauthreqesut implement it
|
2021-02-08 10:30:30 +00:00
|
|
|
type Request interface {
|
|
|
|
Type() AuthRequestType
|
|
|
|
IsValid() bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type AuthRequestType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
AuthRequestTypeOIDC AuthRequestType = iota
|
|
|
|
AuthRequestTypeSAML
|
|
|
|
)
|
|
|
|
|
|
|
|
type AuthRequestOIDC struct {
|
|
|
|
Scopes []string
|
|
|
|
ResponseType OIDCResponseType
|
|
|
|
Nonce string
|
|
|
|
CodeChallenge *OIDCCodeChallenge
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *AuthRequestOIDC) Type() AuthRequestType {
|
|
|
|
return AuthRequestTypeOIDC
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *AuthRequestOIDC) IsValid() bool {
|
|
|
|
return len(a.Scopes) > 0 &&
|
|
|
|
a.CodeChallenge == nil || a.CodeChallenge != nil && a.CodeChallenge.IsValid()
|
|
|
|
}
|
|
|
|
|
|
|
|
type AuthRequestSAML struct {
|
2022-09-12 16:18:08 +00:00
|
|
|
ID string
|
|
|
|
RequestID string
|
|
|
|
BindingType string
|
|
|
|
Code string
|
|
|
|
Issuer string
|
|
|
|
IssuerName string
|
|
|
|
Destination string
|
2021-02-08 10:30:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *AuthRequestSAML) Type() AuthRequestType {
|
|
|
|
return AuthRequestTypeSAML
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *AuthRequestSAML) IsValid() bool {
|
|
|
|
return true
|
|
|
|
}
|