mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-10 07:37:33 +02:00
core/authenticate: refactor identity authenticators to initiate redirect (#4858)
* core/authenticate: refactor identity authenticators to initiate redirect, use cookie for redirect url for cognito * set secure and http only, update test
This commit is contained in:
parent
4c15b202d1
commit
3adbc65d37
14 changed files with 237 additions and 125 deletions
|
@ -137,7 +137,7 @@ func TestAuthenticate_SignOut(t *testing.T) {
|
|||
"",
|
||||
"sig",
|
||||
"ts",
|
||||
identity.MockProvider{GetSignOutURLResponse: "https://microsoft.com"},
|
||||
identity.MockProvider{SignOutError: oidc.ErrSignoutNotImplemented},
|
||||
&mstore.Store{Encrypted: true, Session: &sessions.State{}},
|
||||
http.StatusFound,
|
||||
"",
|
||||
|
@ -150,7 +150,7 @@ func TestAuthenticate_SignOut(t *testing.T) {
|
|||
"https://signout-redirect-url.example.com",
|
||||
"sig",
|
||||
"ts",
|
||||
identity.MockProvider{GetSignOutURLError: oidc.ErrSignoutNotImplemented},
|
||||
identity.MockProvider{SignOutError: oidc.ErrSignoutNotImplemented},
|
||||
&mstore.Store{Encrypted: true, Session: &sessions.State{}},
|
||||
http.StatusFound,
|
||||
"",
|
||||
|
@ -163,7 +163,7 @@ func TestAuthenticate_SignOut(t *testing.T) {
|
|||
"",
|
||||
"sig",
|
||||
"ts",
|
||||
identity.MockProvider{GetSignOutURLError: oidc.ErrSignoutNotImplemented, RevokeError: errors.New("OH NO")},
|
||||
identity.MockProvider{SignOutError: oidc.ErrSignoutNotImplemented, RevokeError: errors.New("OH NO")},
|
||||
&mstore.Store{Encrypted: true, Session: &sessions.State{}},
|
||||
http.StatusFound,
|
||||
"",
|
||||
|
@ -176,7 +176,7 @@ func TestAuthenticate_SignOut(t *testing.T) {
|
|||
"",
|
||||
"sig",
|
||||
"ts",
|
||||
identity.MockProvider{GetSignOutURLError: oidc.ErrSignoutNotImplemented, RevokeError: errors.New("OH NO")},
|
||||
identity.MockProvider{SignOutError: oidc.ErrSignoutNotImplemented, RevokeError: errors.New("OH NO")},
|
||||
&mstore.Store{Encrypted: true, Session: &sessions.State{}},
|
||||
http.StatusFound,
|
||||
"",
|
||||
|
@ -189,7 +189,7 @@ func TestAuthenticate_SignOut(t *testing.T) {
|
|||
"",
|
||||
"sig",
|
||||
"ts",
|
||||
identity.MockProvider{GetSignOutURLError: oidc.ErrSignoutNotImplemented},
|
||||
identity.MockProvider{SignOutError: oidc.ErrSignoutNotImplemented},
|
||||
&mstore.Store{Encrypted: true, Session: &sessions.State{}},
|
||||
http.StatusFound,
|
||||
"",
|
||||
|
@ -401,7 +401,7 @@ func TestAuthenticate_SessionValidatorMiddleware(t *testing.T) {
|
|||
&mstore.Store{Session: &sessions.State{IdentityProviderID: idp.GetId(), ID: "xyz"}},
|
||||
errors.New("hi"),
|
||||
identity.MockProvider{},
|
||||
http.StatusFound,
|
||||
http.StatusOK,
|
||||
},
|
||||
{
|
||||
"expired,refresh error",
|
||||
|
@ -409,7 +409,7 @@ func TestAuthenticate_SessionValidatorMiddleware(t *testing.T) {
|
|||
&mstore.Store{Session: &sessions.State{IdentityProviderID: idp.GetId(), ID: "xyz"}},
|
||||
sessions.ErrExpired,
|
||||
identity.MockProvider{RefreshError: errors.New("error")},
|
||||
http.StatusFound,
|
||||
http.StatusOK,
|
||||
},
|
||||
{
|
||||
"expired,save error",
|
||||
|
@ -417,7 +417,7 @@ func TestAuthenticate_SessionValidatorMiddleware(t *testing.T) {
|
|||
&mstore.Store{SaveError: errors.New("error"), Session: &sessions.State{IdentityProviderID: idp.GetId(), ID: "xyz"}},
|
||||
sessions.ErrExpired,
|
||||
identity.MockProvider{RefreshResponse: oauth2.Token{Expiry: time.Now().Add(10 * time.Minute)}},
|
||||
http.StatusFound,
|
||||
http.StatusOK,
|
||||
},
|
||||
{
|
||||
"expired XHR,refresh error",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue