public DiscordAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name, "ClientId", "ClientSecret") { AuthorizeUrl = appSettings.Get($"oauth.{Name}.AuthorizeUrl", DefaultAuthorizeUrl); AccessTokenUrl = appSettings.Get($"oauth.{Name}.AccessTokenUrl", DefaultAccessTokenUrl); UserProfileUrl = appSettings.Get($"oauth.{Name}.UserProfileUrl", DefaultUserProfileUrl); if (Scopes == null || Scopes.Length == 0) { Scopes = new[] { "identify", "email" }; } Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M14.82 4.26a10.14 10.14 0 0 0-.53 1.1a14.66 14.66 0 0 0-4.58 0a10.14 10.14 0 0 0-.53-1.1a16 16 0 0 0-4.13 1.3a17.33 17.33 0 0 0-3 11.59a16.6 16.6 0 0 0 5.07 2.59A12.89 12.89 0 0 0 8.23 18a9.65 9.65 0 0 1-1.71-.83a3.39 3.39 0 0 0 .42-.33a11.66 11.66 0 0 0 10.12 0q.21.18.42.33a10.84 10.84 0 0 1-1.71.84a12.41 12.41 0 0 0 1.08 1.78a16.44 16.44 0 0 0 5.06-2.59a17.22 17.22 0 0 0-3-11.59a16.09 16.09 0 0 0-4.09-1.35zM8.68 14.81a1.94 1.94 0 0 1-1.8-2a1.93 1.93 0 0 1 1.8-2a1.93 1.93 0 0 1 1.8 2a1.93 1.93 0 0 1-1.8 2zm6.64 0a1.94 1.94 0 0 1-1.8-2a1.93 1.93 0 0 1 1.8-2a1.92 1.92 0 0 1 1.8 2a1.92 1.92 0 0 1-1.8 2z' fill='currentColor'/></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with Discord", Id = "btn-" + Name, ClassName = "btn-social btn-discord", IconClass = "fab fa-discord", }; }
public GoogleAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name) { VerifyAccessTokenAsync = OnVerifyAccessTokenAsync; this.AuthorizeUrl = appSettings.Get($"oauth.{Name}.AuthorizeUrl", DefaultAuthorizeUrl); this.AccessTokenUrl = appSettings.Get($"oauth.{Name}.AccessTokenUrl", DefaultAccessTokenUrl); this.UserProfileUrl = appSettings.Get($"oauth.{Name}.UserProfileUrl", DefaultUserProfileUrl); this.VerifyTokenUrl = appSettings.Get($"oauth.{Name}.VerifyTokenUrl", DefaultVerifyTokenUrl); if (this.Scopes == null || this.Scopes.Length == 0) { this.Scopes = new[] { "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email" }; } Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'><path d='M11.99 13.9v-3.72h9.36c.14.63.25 1.22.25 2.05c0 5.71-3.83 9.77-9.6 9.77c-5.52 0-10-4.48-10-10S6.48 2 12 2c2.7 0 4.96.99 6.69 2.61l-2.84 2.76c-.72-.68-1.98-1.48-3.85-1.48c-3.31 0-6.01 2.75-6.01 6.12s2.7 6.12 6.01 6.12c3.83 0 5.24-2.65 5.5-4.22h-5.51v-.01z' fill='currentColor' /></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with Google", Id = "btn-" + Name, ClassName = "btn-social btn-google", IconClass = "fab svg-google", }; }
public LinkedInAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name) { this.AuthorizeUrl = appSettings.Get($"oauth.{Name}.AuthorizeUrl", DefaultAuthorizeUrl); this.AccessTokenUrl = appSettings.Get($"oauth.{Name}.AccessTokenUrl", DefaultAccessTokenUrl); //Fields available at: http://developer.linkedin.com/documents/profile-fields this.UserProfileUrl = appSettings.Get($"oauth.{Name}.UserProfileUrl", DefaultUserProfileUrl); if (this.Scopes == null || this.Scopes.Length == 0) { this.Scopes = new[] { "r_emailaddress", "r_basicprofile" }; } Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><g fill='none'><path fill-rule='evenodd' clip-rule='evenodd' d='M1 2.838A1.838 1.838 0 0 1 2.838 1H21.16A1.837 1.837 0 0 1 23 2.838V21.16A1.838 1.838 0 0 1 21.161 23H2.838A1.838 1.838 0 0 1 1 21.161V2.838zm8.708 6.55h2.979v1.496c.43-.86 1.53-1.634 3.183-1.634c3.169 0 3.92 1.713 3.92 4.856v5.822h-3.207v-5.106c0-1.79-.43-2.8-1.522-2.8c-1.515 0-2.145 1.089-2.145 2.8v5.106H9.708V9.388zm-5.5 10.403h3.208V9.25H4.208v10.54zM7.875 5.812a2.063 2.063 0 1 1-4.125 0a2.063 2.063 0 0 1 4.125 0z' fill='currentColor'/></g></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with LinkedIn", Id = "btn-" + Name, ClassName = "btn-social btn-linkedin", IconClass = "fab svg-linkedin", }; }
public TwitterAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name) { this.AuthorizeUrl = appSettings.Get("oauth.twitter.AuthorizeUrl", DefaultAuthorizeUrl); Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 20 20'><path d='M6.29 18.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0020 3.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.073 4.073 0 01.8 7.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 010 16.407a11.616 11.616 0 006.29 1.84' /></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with Twitter", Id = "btn-" + Name, ClassName = "btn-social btn-twitter", IconClass = "fab svg-twitter", }; }
public FacebookAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name, "AppId", "AppSecret") { this.AppId = appSettings.GetString("oauth.facebook.AppId"); this.AppSecret = appSettings.GetString("oauth.facebook.AppSecret"); this.Permissions = appSettings.Get("oauth.facebook.Permissions", TypeConstants.EmptyStringArray); this.Fields = appSettings.Get("oauth.facebook.Fields", DefaultFields); Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 20 20'><path fill-rule='evenodd' d='M20 10c0-5.523-4.477-10-10-10S0 4.477 0 10c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V10h2.54V7.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V10h2.773l-.443 2.89h-2.33v6.988C16.343 19.128 20 14.991 20 10z' clip-rule='evenodd' /></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with Facebook", Id = "btn-" + Name, ClassName = "btn-social btn-facebook", IconClass = "fab svg-facebook", }; }
public GithubAuthProvider(IAppSettings appSettings) : base(appSettings, Realm, Name, "ClientId", "ClientSecret") { ClientId = appSettings.GetString("oauth.github.ClientId"); ClientSecret = appSettings.GetString("oauth.github.ClientSecret"); Scopes = appSettings.Get("oauth.github.Scopes", new[] { "user" }); PreAuthUrl = DefaultPreAuthUrl; VerifyAccessTokenUrl = DefaultVerifyAccessTokenUrl; ClientConfig.ConfigureTls12(); Icon = Svg.ImageSvg("<svg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 20 20'><path fill-rule='evenodd' d='M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z' clip-rule='evenodd' /></svg>"); NavItem = new NavItem { Href = "/auth/" + Name, Label = "Sign In with GitHub", Id = "btn-" + Name, ClassName = "btn-social btn-github", IconClass = "fab svg-github", }; }