예제 #1
0
        protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            var token = TokenRetrieval.FromAuthorizationHeader()(Context.Request);

            if (token == null)
            {
                return(AuthenticateResult.NoResult());
            }

            if (token.Length != LykkeTokenLength)
            {
                var result = await base.HandleAuthenticateAsync();

                return(result);
            }

            var principal = await _lykkePrincipal.GetCurrent();

            if (principal == null)
            {
                return(AuthenticateResult.NoResult());
            }

            var ticket = new AuthenticationTicket(principal, "Bearer");

            return(AuthenticateResult.Success(ticket));
        }
        protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            var principal = await _lykkePrincipal.GetCurrent();

            if (principal == null)
            {
                return(AuthenticateResult.NoResult());
            }

            var ticket = new AuthenticationTicket(principal, "Bearer");

            return(AuthenticateResult.Success(ticket));
        }