Sunday, 15 August 2010

authentication - Servicestack add field UserAuth table and check on login -


Text after "

I want to add new area (s) to the UserAuth table (for example: Blocked, verified) and when I check Want to log in. How can I do this?

Finally I did not find anotherway solution for my project ...

1) SessionsFeaute in pairs plugins:

  this.Plugins.Add (New SessionFeature () {SessionExpiry = TimespanFrames Minutes (15)});  

2) Register ICacheClient:

  container.Register & lt; ICacheClient & gt; (New MemoryCacheClient ()); 3) Certified method:  
  Public Zero Certified (ISession session, user user) {session.Set ("UserInfo", user); }  

4) Logout method:. Set session.GetSessionBag () & lt; Users & gt; ("UserInfo", tap);

5) RequestFilter:

  public class UserInfoFilterAttribute: RequestFilterAttribute {public UserInfoFilterAttribute () {} Public UserInfoFilterAttribute (applyTo applyTo): Base (applyTo) {} Public override zero executed (IRequest request, IResponse race, Object RequestDto) {var user = req.GetSessionBag (). & Lt; Users & gt; ("User Information"); If (user == tap) {res.StatusCode = (int) HttpStatusCode.Unauthorized; Res.EndRequest (); 6} Finally using a filter for a restricted service.  
  [UserInfoFilterAttribute] Public class AccountInfoService: ServiceStack.Service {}   

/ pre>

Thanks anyway ... < / P>


No comments:

Post a Comment