/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers * for more information concerning the license and the contributors participating to this project. */ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using System.Security.Claims; using static ZeroFramework.IdentityServer.API.Infrastructure.Authentication.Weibo.WeiboAuthenticationConstants; namespace ZeroFramework.IdentityServer.API.Infrastructure.Authentication.Weibo; /// /// Defines a set of options used by . /// public class WeiboAuthenticationOptions : OAuthOptions { public WeiboAuthenticationOptions() { ClaimsIssuer = WeiboAuthenticationDefaults.Issuer; CallbackPath = WeiboAuthenticationDefaults.CallbackPath; AuthorizationEndpoint = WeiboAuthenticationDefaults.AuthorizationEndpoint; TokenEndpoint = WeiboAuthenticationDefaults.TokenEndpoint; UserInformationEndpoint = WeiboAuthenticationDefaults.UserInformationEndpoint; ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); ClaimActions.MapJsonKey(ClaimTypes.Name, "name"); ClaimActions.MapJsonKey(ClaimTypes.Gender, "gender"); ClaimActions.MapJsonKey(Claims.ScreenName, "screen_name"); ClaimActions.MapJsonKey(Claims.ProfileImageUrl, "profile_image_url"); ClaimActions.MapJsonKey(Claims.AvatarLarge, "avatar_large"); ClaimActions.MapJsonKey(Claims.AvatarHd, "avatar_hd"); ClaimActions.MapJsonKey(Claims.CoverImagePhone, "cover_image_phone"); ClaimActions.MapJsonKey(Claims.Location, "location"); Scope.Add("email"); } /// /// Gets or sets the address of the endpoint exposing /// the email addresses associated with the logged in user. /// public string UserEmailsEndpoint { get; set; } = WeiboAuthenticationDefaults.UserEmailsEndpoint; }