AuthN: Fix signout redirect url (#87631)
* Add missing return * Use sign out redirect url from auth config if configured * remove option from auth.jwt that is not used
This commit is contained in:
@@ -409,7 +409,8 @@ func TestService_Logout(t *testing.T) {
|
||||
identity *authn.Identity
|
||||
sessionToken *usertoken.UserToken
|
||||
|
||||
client authn.Client
|
||||
client authn.Client
|
||||
signoutRedirectURL string
|
||||
|
||||
expectedErr error
|
||||
expectedTokenRevoked bool
|
||||
@@ -441,6 +442,14 @@ func TestService_Logout(t *testing.T) {
|
||||
client: &authntest.FakeClient{ExpectedName: "auth.client.azuread"},
|
||||
expectedTokenRevoked: true,
|
||||
},
|
||||
{
|
||||
desc: "should use signout redirect url if configured",
|
||||
identity: &authn.Identity{ID: authn.NewNamespaceID(authn.NamespaceUser, 1), AuthenticatedBy: "azuread"},
|
||||
expectedRedirect: &authn.Redirect{URL: "some-url"},
|
||||
client: &authntest.FakeClient{ExpectedName: "auth.client.azuread"},
|
||||
signoutRedirectURL: "some-url",
|
||||
expectedTokenRevoked: true,
|
||||
},
|
||||
{
|
||||
desc: "should redirect to client specific url",
|
||||
identity: &authn.Identity{ID: authn.NewNamespaceID(authn.NamespaceUser, 1), AuthenticatedBy: "azuread"},
|
||||
@@ -473,6 +482,10 @@ func TestService_Logout(t *testing.T) {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
if tt.signoutRedirectURL != "" {
|
||||
svc.cfg.SignoutRedirectUrl = tt.signoutRedirectURL
|
||||
}
|
||||
})
|
||||
|
||||
redirect, err := s.Logout(context.Background(), tt.identity, tt.sessionToken)
|
||||
|
||||
Reference in New Issue
Block a user