public MobileAppAuthenticationHandlerTests()
 {
     this.config = new HttpConfiguration();
     this.tokenHandler = new MobileAppTokenHandler(this.config);
     this.loggerMock = new Mock<ILogger>();
     this.handlerMock = new MobileAppAuthenticationHandlerMock(this.loggerMock.Object, this.tokenHandler);
 }
 public MobileAppTokenHandlerTests()
 {
     this.config = new HttpConfiguration();
     this.tokenHandlerMock = new Mock<MobileAppTokenHandler>(this.config) { CallBase = true };
     this.tokenHandler = this.tokenHandlerMock.Object;
     this.credentials = new FacebookCredentials
     {
         UserId = "Facebook:1234",
         AccessToken = "abc123"
     };
 }
        public static IMobileAppTokenHandler GetMobileAppTokenHandler(this HttpConfiguration config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            IMobileAppTokenHandler handler;
            if (!config.Properties.TryGetValue(ServiceTokenHandlerKey, out handler))
            {
                handler = new MobileAppTokenHandler(config);
                config.Properties[ServiceTokenHandlerKey] = handler;
            }

            return handler;
        }
        protected virtual bool TryParseLoginToken(string token, MobileAppAuthenticationOptions options, out ClaimsPrincipal claimsPrincipal)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (!options.SkipTokenSignatureValidation)
            {
                return(this.tokenUtility.TryValidateLoginToken(token, options.SigningKey, out claimsPrincipal));
            }
            else
            {
                // With token signature validation turned off, we assume validation
                // has been done externally, and we trust all the claims.
                return(MobileAppTokenHandler.GetClaimsPrincipalForPrevalidatedToken(token, out claimsPrincipal));
            }
        }