ServiceStack CredentialAuthProvider with more than user / password

I want to use a custom auth provider, but I don’t see how I can get standard Auth objects to process more of this user and password as parameters.

Can this be done?

+4
source share
1 answer

Depends on what you want to do, if you want to create your own custom auth provider, inheriting from CredentialsAuthProvider, you can access various request parameters through the IHttpRequest object:

 public virtual bool TryAuthenticate(IServiceBase authService, string userName, string password) { var httpReq = authService.RequestContext.Get<IHttpRequest>(); var fromQueryString = httpRequest.QueryString["CustomField"]; var fromPostData = httpRequest.FormData["CustomField"]; var fromEither = httpRequest.GetParam("CustomField"); //Ext method } 

Here are some other related questions and answers that show the various ways to configure ServiceStack inline Auth:

+3
source

Source: https://habr.com/ru/post/1436681/


All Articles