private AuthenticationTicket Authenticate()
        {
            HmacAuthenticationResult result = authenticationService.Authenticate(Request.ToRequestInfo());

            Claim claim = new Claim(ClaimTypes.NameIdentifier, result.AppId);

            return(new AuthenticationTicket(
                       new ClaimsIdentity(new[] { claim }, Schemas.HMAC),
                       new AuthenticationProperties()));
        }
        private AuthenticateResult Authenticate()
        {
            HmacAuthenticationResult auth = authenticationService.Authenticate(Request.ToRequestInfo());

            var                  claims    = new[] { new Claim(ClaimTypes.NameIdentifier, auth.AppId) };
            ClaimsPrincipal      principal = new ClaimsPrincipal(new ClaimsIdentity(claims, Scheme.Name));
            AuthenticationTicket ticket    = new AuthenticationTicket(principal, Scheme.Name);

            return(AuthenticateResult.Success(ticket));
        }
예제 #3
0
 private bool Authenticated(IOwinContext context)
 {
     try
     {
         authenticationService.Authenticate(context.Request.ToRequestInfo());
         return(true);
     }
     catch (HmacAuthenticationException)
     {
         return(false);
     }
 }
예제 #4
0
        private bool Authenticated(HttpRequestMessage request)
        {
            try
            {
                authenticationService.Authenticate(request.ToRequestInfo());

                return(true);
            }
            catch (HmacAuthenticationException)
            {
                return(false);
            }
        }
예제 #5
0
        public bool Authenticated(HttpContext context)
        {
            try
            {
                authenticationService.Authenticate(context.Request.ToRequestInfo());
                return(true);
            }
            catch (HmacAuthenticationException e)
            {
                loggerFactory.CreateLogger <HmacMiddleware>()
                .LogInformation(e, $"HMAC authentication failed: {e.Message}");

                return(false);
            }
        }