AuthN: Add oauth clients and perform oauth authentication with authn.Service (#62072)

* AuthN: Update signature of redirect client and RedirectURL function

* OAuth: use authn.Service to perform oauth authentication and login if feature toggle is enabled

* AuthN: register oauth clients

* AuthN: set auth module metadata

* AuthN: add logs for failed login attempts

* AuthN: Don't use enable disabled setting

* OAuth: only run hooks when authnService feature toggle is disabled

* OAuth: Add function to handle oauth errors from authn.Service
This commit is contained in:
Karl Persson
2023-01-30 12:45:04 +01:00
committed by GitHub
parent e3bfc67d7b
commit efeb0daec6
8 changed files with 681 additions and 39 deletions

View File

@@ -53,6 +53,8 @@ type FakeRedirectClient struct {
ExpectedErr error
ExpectedURL string
ExpectedName string
ExpectedOK bool
ExpectedRedirect *authn.Redirect
ExpectedIdentity *authn.Identity
}
@@ -64,6 +66,10 @@ func (f FakeRedirectClient) Authenticate(ctx context.Context, r *authn.Request)
return f.ExpectedIdentity, f.ExpectedErr
}
func (f FakeRedirectClient) RedirectURL(ctx context.Context, r *authn.Request) (string, error) {
return f.ExpectedURL, f.ExpectedErr
func (f FakeRedirectClient) RedirectURL(ctx context.Context, r *authn.Request) (*authn.Redirect, error) {
return f.ExpectedRedirect, f.ExpectedErr
}
func (f FakeRedirectClient) Test(ctx context.Context, r *authn.Request) bool {
return f.ExpectedOK
}