Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RoomsAuthProvider : BasicAuthProvider
- {
- public RoomsAuthProvider(AppSettings appSettings) : base(appSettings)
- {
- }
- public RoomsAuthProvider()
- {
- }
- public override bool TryAuthenticate(IServiceBase authService,
- string userName, string password)
- {
- return true;
- }
- public override IHttpResult OnAuthenticated(IServiceBase authService,
- IAuthSession session, IAuthTokens tokens,
- Dictionary<string, string> authInfo)
- {
- session.FirstName = "some_firstname_from_db";
- return base.OnAuthenticated(authService, session, tokens, authInfo);
- }
- }
- public override void Configure(Funq.Container container)
- {
- container.Register<ICacheClient>(new MemoryCacheClient());
- Plugins.Add(new AuthFeature(() => new AuthUserSession(),
- new IAuthProvider[]
- {
- new RoomsAuthProvider()
- }));
- Plugins.Add(new ServerEventsFeature());
- }
- var client = new ServerEventsClient("http://localhost:1337/", "home")
- var authResponse = client.Authenticate(new Authenticate
- {
- provider = "RoomsAuthProvider",
- UserName = "test@gmail.com",
- Password = "p@55w0rd",
- RememberMe = true,
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement