public HalloSecureModule(IWebTokenService webTokenService) : base(webTokenService) { Get["/secure/hallo"] = _ => { return($"Hallo {CurrentLogon.UserName}, deze url wordt beveiligd met een JSON web token"); }; }
public AuthModule( IAuthenticationService authenticationService, IWebTokenService webTokenService, ILoggingService loggingService) { Post["/auth/token"] = _ => { var authRequest = this.Bind <AuthenticationRequest>(); var logon = authenticationService.GetLogonByCredentials(authRequest.Naam, authRequest.Wachtwoord); if (logon == null) { loggingService.LogMessage("Inloggen mislukt"); return(new Response { StatusCode = HttpStatusCode.BadRequest, ReasonPhrase = "Onbekende combinatie van gebruikersnaam en wachtwoord" }); } loggingService.LogMessage("Inloggen gelukt"); var identity = logon.ToClaimsIdentity(); var token = webTokenService.CreateToken(identity); return(token); }; }
public AuthService( UserManager <AppUser> userManager, IMapper mapper, IWebTokenService webTokenService, IUrlService urlService, IEncodingService encodingService, IEmailService emailService) { _userManager = userManager; _mapper = mapper; _webTokenService = webTokenService; _urlService = urlService; _encodingService = encodingService; _emailService = emailService; }
public SecureModule(IWebTokenService webTokenService) { this.WebTokenService = webTokenService; this.Before += BeforeResponse; }