mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-01 11:52:15 +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
@@ -98,8 +98,10 @@ func prepareDeviceAuthQuery() (sq.SelectBuilder, func(*sql.Row) (*domain.AuthReq
|
||||
LeftJoin(join(ProjectColumnID, AppColumnProjectID)).
|
||||
PlaceholderFormat(sq.Dollar),
|
||||
func(row *sql.Row) (*domain.AuthRequestDevice, error) {
|
||||
dst := new(domain.AuthRequestDevice)
|
||||
var (
|
||||
clientID string
|
||||
deviceCode string
|
||||
userCode string
|
||||
scopes database.TextArray[string]
|
||||
audience database.TextArray[string]
|
||||
appName sql.NullString
|
||||
@@ -107,9 +109,9 @@ func prepareDeviceAuthQuery() (sq.SelectBuilder, func(*sql.Row) (*domain.AuthReq
|
||||
)
|
||||
|
||||
err := row.Scan(
|
||||
&dst.ClientID,
|
||||
&dst.DeviceCode,
|
||||
&dst.UserCode,
|
||||
&clientID,
|
||||
&deviceCode,
|
||||
&userCode,
|
||||
&scopes,
|
||||
&audience,
|
||||
&appName,
|
||||
@@ -121,11 +123,6 @@ func prepareDeviceAuthQuery() (sq.SelectBuilder, func(*sql.Row) (*domain.AuthReq
|
||||
if err != nil {
|
||||
return nil, zerrors.ThrowInternal(err, "QUERY-Voo3o", "Errors.Internal")
|
||||
}
|
||||
dst.Scopes = scopes
|
||||
dst.Audience = audience
|
||||
dst.AppName = appName.String
|
||||
dst.ProjectName = projectName.String
|
||||
|
||||
return dst, nil
|
||||
return domain.NewAuthRequestDevice(clientID, deviceCode, userCode, scopes, audience, appName.String, projectName.String), nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,15 +52,15 @@ var (
|
||||
"appName",
|
||||
"projectName",
|
||||
}
|
||||
expectedDeviceAuth = &domain.AuthRequestDevice{
|
||||
ClientID: "client-id",
|
||||
DeviceCode: "device1",
|
||||
UserCode: "user-code",
|
||||
Scopes: []string{"a", "b", "c"},
|
||||
Audience: []string{"projectID", "clientID"},
|
||||
AppName: "appName",
|
||||
ProjectName: "projectName",
|
||||
}
|
||||
expectedDeviceAuth = domain.NewAuthRequestDevice(
|
||||
"client-id",
|
||||
"device1",
|
||||
"user-code",
|
||||
[]string{"a", "b", "c"},
|
||||
[]string{"projectID", "clientID"},
|
||||
"appName",
|
||||
"projectName",
|
||||
)
|
||||
)
|
||||
|
||||
func TestQueries_DeviceAuthRequestByUserCode(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user