47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
8 years ago
|
using Microsoft.AspNet.Authentication.OAuth;
|
||
|
using Microsoft.AspNet.Http;
|
||
|
|
||
|
namespace Yavsc.Auth
|
||
|
{
|
||
8 years ago
|
public static class YavscGoogleDefaults
|
||
8 years ago
|
{
|
||
|
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>
|
||
8 years ago
|
public class YavscGoogleOptions : OAuthOptions
|
||
8 years ago
|
{
|
||
|
/// <summary>
|
||
8 years ago
|
/// Initializes a new <see cref="YavscGoogleOptions"/>.
|
||
8 years ago
|
/// </summary>
|
||
8 years ago
|
public YavscGoogleOptions()
|
||
8 years ago
|
{
|
||
8 years ago
|
AuthenticationScheme = YavscGoogleDefaults.AuthenticationScheme;
|
||
8 years ago
|
DisplayName = AuthenticationScheme;
|
||
|
CallbackPath = new PathString("/signin-google");
|
||
8 years ago
|
AuthorizationEndpoint = YavscGoogleDefaults.AuthorizationEndpoint;
|
||
|
TokenEndpoint = YavscGoogleDefaults.TokenEndpoint;
|
||
|
UserInformationEndpoint = YavscGoogleDefaults.UserInformationEndpoint;
|
||
8 years ago
|
Scope.Add("openid");
|
||
|
Scope.Add("profile");
|
||
|
Scope.Add("email");
|
||
8 years ago
|
|
||
8 years ago
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// access_type. Set to 'offline' to request a refresh token.
|
||
|
/// </summary>
|
||
|
public string AccessType { get; set; }
|
||
|
|
||
8 years ago
|
|
||
8 years ago
|
}
|
||
|
}
|