yavsc/Yavsc/Auth/GoogleOptions.cs

46 lines
1.5 KiB
C#
Raw Normal View History

2016-05-17 18:22:18 +02:00
using Microsoft.AspNet.Authentication.OAuth;
using Microsoft.AspNet.Http;
namespace Yavsc.Auth
{
2016-06-06 12:38:11 +02:00
public static class YavscGoogleDefaults
2016-05-17 18:22:18 +02:00
{
public const string AuthenticationScheme = "Google";
public static readonly string AuthorizationEndpoint = "https://accounts.google.com/o/oauth2/auth";
public static readonly string TokenEndpoint = "https://www.googleapis.com/oauth2/v3/token";
public static readonly string UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me";
}
/// <summary>
/// Configuration options for <see cref="GoogleMiddleware"/>.
/// </summary>
2016-06-06 12:38:11 +02:00
public class YavscGoogleOptions : OAuthOptions
2016-05-17 18:22:18 +02:00
{
/// <summary>
2016-06-06 12:38:11 +02:00
/// Initializes a new <see cref="YavscGoogleOptions"/>.
2016-05-17 18:22:18 +02:00
/// </summary>
2016-06-06 12:38:11 +02:00
public YavscGoogleOptions()
2016-05-17 18:22:18 +02:00
{
2016-06-06 12:38:11 +02:00
AuthenticationScheme = YavscGoogleDefaults.AuthenticationScheme;
2016-05-17 18:22:18 +02:00
DisplayName = AuthenticationScheme;
CallbackPath = new PathString("/signin-google");
2016-06-06 12:38:11 +02:00
AuthorizationEndpoint = YavscGoogleDefaults.AuthorizationEndpoint;
TokenEndpoint = YavscGoogleDefaults.TokenEndpoint;
UserInformationEndpoint = YavscGoogleDefaults.UserInformationEndpoint;
2016-05-17 18:22:18 +02:00
Scope.Add("openid");
Scope.Add("profile");
Scope.Add("email");
2016-06-12 01:32:51 +02:00
2016-05-17 18:22:18 +02:00
}
/// <summary>
/// access_type. Set to 'offline' to request a refresh token.
/// </summary>
public string AccessType { get; set; }
2016-06-12 01:32:51 +02:00
2016-05-17 18:22:18 +02:00
}
}