예제 #1
0
        public async Task <bool> SignUpUser(IAuthenticationManager authenticationManager, ISecureDataFormat <AuthenticationTicket> df, AuthenticationTicket at)
        {
            List <ClaimsIdentity> claims = new List <ClaimsIdentity>()
            {
                new ClaimsIdentity()
            };
            AuthenticationProperties authProp = new AuthenticationProperties();

            var authResult = await authenticationManager.AuthenticateAsync("");

            authenticationManager.Challenge(new string[] { "" });
            var authResults = await authenticationManager.AuthenticateAsync(new string[] { "", "" });

            authenticationManager.Challenge(authProp, new string[] { "" });
            authenticationManager.SignOut(authProp, new string[] { "" });

            string prot = df.Protect(at);
            AuthenticationTicket unProtectedAT = df.Unprotect(prot);

            return(at.Equals(unProtectedAT));
        }
예제 #2
0
        public async Task <bool> SignUpUser(IAuthenticationManager authenticationManager, ISecureDataFormat <AuthenticationTicket> df)
        {
            List <ClaimsIdentity> claims = new List <ClaimsIdentity>()
            {
                new ClaimsIdentity()
            };
            AuthenticationProperties authProp = new AuthenticationProperties();

            var authResult = await authenticationManager.AuthenticateAsync("");

            authenticationManager.Challenge(new string[] { "" });
            var authResults = await authenticationManager.AuthenticateAsync(new string[] { "", "" });

            authenticationManager.Challenge(authProp, new string[] { "" });
            var authTypes = authenticationManager.GetAuthenticationTypes();

            authenticationManager.SignIn(claims.ToArray());
            authenticationManager.SignOut(authProp, new string[] { "" });

            ExternalLoginInfo info       = authenticationManager.GetExternalLoginInfo();
            ExternalLoginInfo infoAsync1 = await authenticationManager.GetExternalLoginInfoAsync();

            ExternalLoginInfo infoAsync2 = await authenticationManager.GetExternalLoginInfoAsync("key_here", "expected");

            List <AuthenticationDescription> desc = authenticationManager.GetExternalAuthenticationTypes().ToList();
            bool rem      = authenticationManager.TwoFactorBrowserRemembered("userID");
            bool remAsync = await authenticationManager.TwoFactorBrowserRememberedAsync("userID");

            AuthenticationTicket at            = new AuthenticationTicket(claims.First(), authProp);
            string prot                        = df.Protect(at);
            AuthenticationTicket unProtectedAT = df.Unprotect(prot);

            OAuthAuthorizationServerOptions auth = new OAuthAuthorizationServerOptions()
            {
                AccessTokenExpireTimeSpan = new TimeSpan(),
                AllowInsecureHttp         = true,
            };

            return(at.Equals(unProtectedAT));
        }