public QQAuthenticationOptions()
        {
            ClaimsIssuer = QQAuthenticationDefaults.Issuer;
            CallbackPath = new PathString(QQAuthenticationDefaults.CallbackPath);

            AuthorizationEndpoint   = QQAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = QQAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = QQAuthenticationDefaults.UserInformationEndpoint;
            OpenIdEndpoint          = QQAuthenticationDefaults.UserOpenIdEndpoint;

#if NETSTANDARD2_0
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
#endif

#if NETCOREAPP3_0 || NETCOREAPP3_1
            ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
            ClaimActions.MapJsonKey(ClaimTypes.Name, "nickname");
            ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender");

            ClaimActions.MapJsonKey("urn:qq:figureurl", "figureurl");
            ClaimActions.MapJsonKey("urn:qq:figureurl_1", "figureurl_1");
            ClaimActions.MapJsonKey("urn:qq:figureurl_2", "figureurl_2");
            ClaimActions.MapJsonKey("urn:qq:figureurl_qq_1", "figureurl_qq_1");
            ClaimActions.MapJsonKey("urn:qq:figureurl_qq_2", "figureurl_qq_2");
            ClaimActions.MapJsonKey("urn:qq:is_yellow_vip", "is_yellow_vip");
            ClaimActions.MapJsonKey("urn:qq:vip", "vip");
            ClaimActions.MapJsonKey("urn:qq:yellow_vip_level", "yellow_vip_level");
            ClaimActions.MapJsonKey("urn:qq:level", "level");
            ClaimActions.MapJsonKey("urn:qq:is_yellow_year_vip", "is_yellow_year_vip");
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new <see cref="GoogleOptions"/>.
        /// </summary>
        public GoogleOpenIdConnectOptions()
        {
            CallbackPath = new PathString("/signin-google");
            Authority    = "https://accounts.google.com";

            ResponseType = OpenIdConnectResponseType.Code;
            GetClaimsFromUserInfoEndpoint = true;
            SaveTokens = true;

            Events = new OpenIdConnectEvents()
            {
                OnRedirectToIdentityProvider = (context) =>
                {
                    if (context.Request.Path != "/Account/ExternalLogin")
                    {
                        context.Response.Redirect("/account/login");
                        context.HandleResponse();
                    }

                    return(Task.FromResult(0));
                }
            };
            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.GivenName, "name", "givenName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.Surname, "name", "familyName");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, "urn:google:profile", "url");
            ClaimActionCollectionMapExtensions.MapCustomJson(ClaimActions, ClaimTypes.Email, GoogleHelper.GetEmail);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new <see cref="NortonOpenIdConnectOptions"/>.
        /// </summary>
        public NortonOpenIdConnectOptions()
        {
            CallbackPath = new PathString("/signin-norton");
            Authority    = NortonDefaults.Development.Authority;

            ResponseType = OpenIdConnectResponseType.Code;
            GetClaimsFromUserInfoEndpoint = true;
            SaveTokens = true;

            Events = new OpenIdConnectEvents()
            {
                OnRedirectToIdentityProvider = (context) =>
                {
                    if (context.Request.Path != "/Account/ExternalLogin")
                    {
                        context.Response.Redirect("/account/login");
                        context.HandleResponse();
                    }

                    return(Task.FromResult(0));
                }
            };
            Scope.Add("openid");
            Scope.Add("profile");
            Scope.Add("email");

            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.GivenName, "name", "givenName");
            ClaimActionCollectionMapExtensions.MapJsonSubKey(ClaimActions, ClaimTypes.Surname, "name", "familyName");
        }
Ejemplo n.º 4
0
        public QQAuthenticationOptions()
        {
            ClaimsIssuer = QQAuthenticationDefaults.Issuer;
            CallbackPath = new PathString(QQAuthenticationDefaults.CallbackPath);

            AuthorizationEndpoint   = QQAuthenticationDefaults.AuthorizationEndpoint;
            TokenEndpoint           = QQAuthenticationDefaults.TokenEndpoint;
            UserInformationEndpoint = QQAuthenticationDefaults.UserInformationEndpoint;
            OpenIdEndpoint          = QQAuthenticationDefaults.UserOpenIdEndpoint;

            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.NameIdentifier, "id");
            ClaimActionCollectionMapExtensions.MapJsonKey(ClaimActions, ClaimTypes.Name, "displayName");
        }