servicestack-authentication-identityserver icon indicating copy to clipboard operation
servicestack-authentication-identityserver copied to clipboard

IdentityServerAuthProvider not implementing IAuthWithRequest?

Open stackedbitz opened this issue 5 years ago • 1 comments

It's convenient to have pre-authentication occur at the same time a secured request is made, especially when using a client like Postman, else one has to a call to /auth/IdentityServer before making another to the desired service call.

Is there any reason why you chose not to add IAuthWithRequest, which requires the implementation of PreAuthenticate(req, res), as an interface for IdentityServerAuthProvider?

stackedbitz avatar Mar 27 '19 02:03 stackedbitz

Furthermore, would you be open to a PR having IdentityServerAuthProvider implement IAuthWithRequest with:

public void PreAuthenticate(IRequest req, IResponse res)
        {
            var bearerToken = req.GetBearerToken();
            var authService = req.TryResolve<AuthenticateService>();
            authService.Request = req;

            Authenticate(authService, req.GetSession(), new Authenticate
            {
                provider = Name,
                oauth_token = bearerToken
            });
        }

stackedbitz avatar Mar 27 '19 15:03 stackedbitz