mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-24 21:48:46 +00:00
Merge commit from fork
* fix: add `Scopes` to `Request` interface so that scopes can be validated on all requests * feat: assert org from scope exists when authorizing requests * fix: check all scopes * comments * check org on callback creation * fix tests * clarifications * fix scope marshaling * fix: enfore organization for authrequest in initiation * fix: filter sessions on the accounts page by organization scope * add integration tests --------- Co-authored-by: Livio Spring <[email protected]> Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
Max Peintner
parent
aa4432dc99
commit
c3a6bdb0bb
@@ -17,6 +17,7 @@ const (
|
||||
type Request interface {
|
||||
Type() AuthRequestType
|
||||
IsValid() bool
|
||||
GetScopes() []string
|
||||
}
|
||||
|
||||
type AuthRequestType int32
|
||||
@@ -35,6 +36,18 @@ type AuthRequestOIDC struct {
|
||||
CodeChallenge *OIDCCodeChallenge
|
||||
}
|
||||
|
||||
func NewAuthRequestOIDC(
|
||||
scopes []string,
|
||||
responseType OIDCResponseType,
|
||||
responseMode OIDCResponseMode,
|
||||
nonce string,
|
||||
codeChallenge *OIDCCodeChallenge,
|
||||
) *AuthRequestOIDC {
|
||||
return &AuthRequestOIDC{
|
||||
scopes, responseType, responseMode, nonce, codeChallenge,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AuthRequestOIDC) Type() AuthRequestType {
|
||||
return AuthRequestTypeOIDC
|
||||
}
|
||||
@@ -44,6 +57,10 @@ func (a *AuthRequestOIDC) IsValid() bool {
|
||||
a.CodeChallenge == nil || a.CodeChallenge != nil && a.CodeChallenge.IsValid()
|
||||
}
|
||||
|
||||
func (a *AuthRequestOIDC) GetScopes() []string {
|
||||
return a.Scopes
|
||||
}
|
||||
|
||||
type AuthRequestSAML struct {
|
||||
ID string
|
||||
BindingType string
|
||||
@@ -61,6 +78,10 @@ func (a *AuthRequestSAML) IsValid() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (*AuthRequestSAML) GetScopes() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
type AuthRequestDevice struct {
|
||||
ClientID string
|
||||
DeviceCode string
|
||||
@@ -71,6 +92,20 @@ type AuthRequestDevice struct {
|
||||
ProjectName string
|
||||
}
|
||||
|
||||
func NewAuthRequestDevice(
|
||||
clientID string,
|
||||
deviceCode string,
|
||||
userCode string,
|
||||
scopes []string,
|
||||
audience []string,
|
||||
appName string,
|
||||
projectName string,
|
||||
) *AuthRequestDevice {
|
||||
return &AuthRequestDevice{
|
||||
clientID, deviceCode, userCode, scopes, audience, appName, projectName,
|
||||
}
|
||||
}
|
||||
|
||||
func (*AuthRequestDevice) Type() AuthRequestType {
|
||||
return AuthRequestTypeDevice
|
||||
}
|
||||
@@ -78,3 +113,7 @@ func (*AuthRequestDevice) Type() AuthRequestType {
|
||||
func (a *AuthRequestDevice) IsValid() bool {
|
||||
return a.DeviceCode != "" && a.UserCode != ""
|
||||
}
|
||||
|
||||
func (a *AuthRequestDevice) GetScopes() []string {
|
||||
return a.Scopes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user