mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-07-07 03:17:38 +00:00
feat(auth): add authenticate callback for fallback logic
* Implement SetAuthenticateCallback in authenticators * Update Authenticate methods to use callback on failure
This commit is contained in:
@@ -37,6 +37,8 @@ func (s *stubAuthenticator) LogoutWithCookie(ctx context.Context, req LogoutRequ
|
||||
return s.Logout(ctx, req)
|
||||
}
|
||||
|
||||
func (s *stubAuthenticator) SetAuthenticateCallback(_ func(r *http.Request) (*UserContext, error)) {}
|
||||
|
||||
func TestChainAuthenticator_Authenticate(t *testing.T) {
|
||||
successCtx := &UserContext{UserID: 42, UserName: "alice"}
|
||||
failStub := &stubAuthenticator{err: fmt.Errorf("no token")}
|
||||
|
||||
Reference in New Issue
Block a user