Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions authd-oidc-brokers/internal/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,10 @@ func (b *Broker) deviceAuth(ctx context.Context, session *session) (string, isAu
return AuthDenied, errorMessageForDisplay(err, "Failed to retrieve groups from Microsoft Graph API")
}

if passwordFileExists(*session) {
Comment thread
nooreldeenmansour marked this conversation as resolved.
return b.finishAuth(session, authInfo)
}

// Store the auth info in the session so that we can use it when handling the
// next IsAuthenticated call for the new password mode.
session.authInfo = authInfo
Expand Down
14 changes: 13 additions & 1 deletion authd-oidc-brokers/internal/broker/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,19 @@ func TestIsAuthenticated(t *testing.T) {
"Successfully_authenticate_user_with_device_auth_and_newpassword": {firstSecret: "-", wantSecondCall: true},
"Successfully_authenticate_user_with_password": {firstMode: authmodes.Password, token: &tokenOptions{}},

"Authenticating_with_qrcode_reacquires_token": {firstSecret: "-", wantSecondCall: true, token: &tokenOptions{}},
"Authenticating_with_qrcode_reacquires_token": {
firstSecret: "-",
token: &tokenOptions{},
wantGroups: []info.Group{{Name: "remote-test-group", UGID: "12345"}, {Name: "local-test-group", UGID: ""}},
wantNextAuthModes: []string{},
},

"Authenticating_with_device_auth_and_existing_password_skips_newpassword": {
firstSecret: "-",
token: &tokenOptions{},
wantGroups: []info.Group{{Name: "remote-test-group", UGID: "12345"}, {Name: "local-test-group", UGID: ""}},
wantNextAuthModes: []string{},
},
"Authenticating_with_password_refreshes_expired_token": {firstMode: authmodes.Password, token: &tokenOptions{expired: true}},
"Authenticating_with_password_still_allowed_if_server_is_unreachable": {
firstMode: authmodes.Password,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Definitely a hashed password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Definitely a token
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
access: next
data: '{}'
access: granted
data: '{"userinfo":{"name":"test-user@email.com","uuid":"test-user-id","dir":"/home/test-user@email.com","shell":"/usr/bin/bash","gecos":"test-user","groups":[{"name":"remote-test-group","ugid":"12345"},{"name":"local-test-group","ugid":""}]}}'
err: <nil>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
access: next
data: '{}'
access: granted
data: '{"userinfo":{"name":"test-user@email.com","uuid":"test-user-id","dir":"/home/test-user@email.com","shell":"/usr/bin/bash","gecos":"test-user","groups":[{"name":"remote-test-group","ugid":"12345"},{"name":"local-test-group","ugid":""}]}}'
err: <nil>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
access: next
data: '{}'
access: granted
data: '{"userinfo":{"name":"test-user@email.com","uuid":"test-user-id","dir":"/home/test-user@email.com","shell":"/usr/bin/bash","gecos":"test-user","groups":[{"name":"remote-test-group","ugid":"12345"},{"name":"local-test-group","ugid":""}]}}'
err: <nil>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
access: next
data: '{}'
access: granted
data: '{"userinfo":{"name":"test-user@email.com","uuid":"test-user-id","dir":"/home/test-user@email.com","shell":"/usr/bin/bash","gecos":"test-user","groups":[{"name":"remote-test-group","ugid":"12345"},{"name":"local-test-group","ugid":""}]}}'
err: <nil>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
access: next
data: '{}'
access: granted
data: '{"userinfo":{"name":"test-user@email.com","uuid":"test-user-id","dir":"/home/test-user@email.com","shell":"/usr/bin/bash","gecos":"test-user","groups":[{"name":"remote-test-group","ugid":"12345"},{"name":"local-test-group","ugid":""}]}}'
err: <nil>
Loading