Merge pull request #2 from Lorac/feature/gitter-provider

Feature/gitter provider
This commit is contained in:
Maxime Roussin-Bélanger
2015-06-24 22:08:40 -04:00
14 changed files with 726 additions and 3 deletions

3
.gitignore vendored
View File

@@ -50,6 +50,9 @@ build/
[Bb]in/
[Oo]bj/
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

View File

@@ -0,0 +1,7 @@
namespace Owin.Security.Providers.Gitter
{
internal static class Constants
{
public const string DefaultAuthenticationType = "Gitter";
}
}

View File

@@ -0,0 +1,29 @@
using System;
namespace Owin.Security.Providers.Gitter
{
public static class GitterAuthenticationExtensions
{
public static IAppBuilder UseGitterAuthentication(this IAppBuilder app,
GitterAuthenticationOptions options)
{
if (app == null)
throw new ArgumentNullException("app");
if (options == null)
throw new ArgumentNullException("options");
app.Use(typeof(GitterAuthenticationMiddleware), app, options);
return app;
}
public static IAppBuilder UseGitterAuthentication(this IAppBuilder app, string clientId, string clientSecret)
{
return app.UseGitterAuthentication(new GitterAuthenticationOptions
{
ClientId = clientId,
ClientSecret = clientSecret
});
}
}
}

View File

@@ -0,0 +1,264 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.Owin;
using Microsoft.Owin.Infrastructure;
using Microsoft.Owin.Logging;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Infrastructure;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Owin.Security.Providers.Gitter.Provider;
namespace Owin.Security.Providers.Gitter
{
public class GitterAuthenticationHandler : AuthenticationHandler<GitterAuthenticationOptions>
{
private const string XmlSchemaString = "http://www.w3.org/2001/XMLSchema#string";
private const string TokenEndpoint = "https://gitter.im/login/oauth/token";
private const string UserInfoEndpoint = "https://api.gitter.im/v1/user";
private const string AuthorizeEndpoint = "https://gitter.im/login/oauth/authorize";
private const string Host = "api.gitter.im";
private readonly ILogger logger;
private readonly HttpClient httpClient;
public GitterAuthenticationHandler(HttpClient httpClient, ILogger logger)
{
this.httpClient = httpClient;
this.logger = logger;
}
protected override async Task<AuthenticationTicket> AuthenticateCoreAsync()
{
AuthenticationProperties properties = null;
try
{
string code = null;
string state = null;
IReadableStringCollection query = Request.Query;
IList<string> values = query.GetValues("code");
if (values != null && values.Count == 1)
{
code = values[0];
}
values = query.GetValues("state");
if (values != null && values.Count == 1)
{
state = values[0];
}
properties = Options.StateDataFormat.Unprotect(state);
if (properties == null)
{
return null;
}
if (!ValidateCorrelationId(properties, logger))
{
return new AuthenticationTicket(null, properties);
}
string requestPrefix = Request.Scheme + "://" + Request.Host;
string redirectUri = requestPrefix + Request.PathBase + Options.CallbackPath;
// Build up the body for the token request
var body = new List<KeyValuePair<string, string>>();
body.Add(new KeyValuePair<string, string>("grant_type", "authorization_code"));
body.Add(new KeyValuePair<string, string>("code", code));
body.Add(new KeyValuePair<string, string>("redirect_uri", redirectUri));
body.Add(new KeyValuePair<string, string>("client_id", Options.ClientId));
body.Add(new KeyValuePair<string, string>("client_secret", Options.ClientSecret));
// Request the token
HttpResponseMessage tokenResponse = await httpClient.PostAsync(TokenEndpoint, new FormUrlEncodedContent(body));
tokenResponse.EnsureSuccessStatusCode();
string text = await tokenResponse.Content.ReadAsStringAsync();
// Deserializes the token response
dynamic response = JsonConvert.DeserializeObject<dynamic>(text);
string accessToken = (string)response.access_token;
string token_type = (string)response.token_type;
// Get the Gitter user
HttpRequestMessage userRequest = new HttpRequestMessage(HttpMethod.Get, UserInfoEndpoint + "?token=" + Uri.EscapeDataString(accessToken));
userRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
userRequest.Headers.Authorization = new AuthenticationHeaderValue(token_type, accessToken);
userRequest.Headers.Host = Host;
HttpResponseMessage userResponse = await httpClient.SendAsync(userRequest, Request.CallCancelled);
userResponse.EnsureSuccessStatusCode();
text = await userResponse.Content.ReadAsStringAsync();
JArray userArray = JArray.Parse(text);
JObject user = JObject.Parse(userArray[0].ToString());
var context = new GitterAuthenticatedContext(Context, user, accessToken, token_type)
{
Identity = new ClaimsIdentity(
Options.AuthenticationType,
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType)
};
if (!string.IsNullOrEmpty(context.UserId))
{
context.Identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, context.UserId, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.Username))
{
context.Identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, context.Username, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserDisplayName))
{
context.Identity.AddClaim(new Claim("urn:gitter:displayName", context.UserDisplayName, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserGV))
{
context.Identity.AddClaim(new Claim("urn:gitter:gv", context.UserAvatarUrlMedium, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserUrl))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Webpage, context.UserUrl, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserAvatarUrlSmall))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Webpage, context.UserAvatarUrlSmall, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserAvatarUrlMedium))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Webpage, context.UserAvatarUrlMedium, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserAvatarUrlMedium))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Webpage, context.UserAvatarUrlMedium, XmlSchemaString, Options.AuthenticationType));
}
context.Properties = properties;
await Options.Provider.Authenticated(context);
return new AuthenticationTicket(context.Identity, context.Properties);
}
catch (Exception ex)
{
logger.WriteError(ex.Message);
}
return new AuthenticationTicket(null, properties);
}
protected override Task ApplyResponseChallengeAsync()
{
if (Response.StatusCode != 401)
{
return Task.FromResult<object>(null);
}
AuthenticationResponseChallenge challenge = Helper.LookupChallenge(Options.AuthenticationType, Options.AuthenticationMode);
if (challenge != null)
{
string baseUri =
Request.Scheme +
Uri.SchemeDelimiter +
Request.Host +
Request.PathBase;
string currentUri =
baseUri +
Request.Path +
Request.QueryString;
string redirectUri =
baseUri +
Options.CallbackPath;
AuthenticationProperties properties = challenge.Properties;
if (string.IsNullOrEmpty(properties.RedirectUri))
{
properties.RedirectUri = currentUri;
}
// OAuth2 10.12 CSRF
GenerateCorrelationId(properties);
// comma separated
string scope = string.Join(",", Options.Scope);
string state = Options.StateDataFormat.Protect(properties);
string authorizationEndpoint =
AuthorizeEndpoint +
"?response_type=code" +
"&client_id=" + Uri.EscapeDataString(Options.ClientId) +
"&redirect_uri=" + Uri.EscapeDataString(redirectUri) +
"&scope=" + Uri.EscapeDataString(scope) +
"&state=" + Uri.EscapeDataString(state);
Response.Redirect(authorizationEndpoint);
}
return Task.FromResult<object>(null);
}
public override async Task<bool> InvokeAsync()
{
return await InvokeReplyPathAsync();
}
private async Task<bool> InvokeReplyPathAsync()
{
if (Options.CallbackPath.HasValue && Options.CallbackPath == Request.Path)
{
AuthenticationTicket ticket = await AuthenticateAsync();
if (ticket == null)
{
logger.WriteWarning("Invalid return state, unable to redirect.");
Response.StatusCode = 500;
return true;
}
var context = new GitterReturnEndpointContext(Context, ticket)
{
SignInAsAuthenticationType = Options.SignInAsAuthenticationType,
RedirectUri = ticket.Properties.RedirectUri
};
await Options.Provider.ReturnEndpoint(context);
if (context.SignInAsAuthenticationType != null &&
context.Identity != null)
{
ClaimsIdentity grantIdentity = context.Identity;
if (!string.Equals(grantIdentity.AuthenticationType, context.SignInAsAuthenticationType, StringComparison.Ordinal))
{
grantIdentity = new ClaimsIdentity(grantIdentity.Claims, context.SignInAsAuthenticationType, grantIdentity.NameClaimType, grantIdentity.RoleClaimType);
}
Context.Authentication.SignIn(context.Properties, grantIdentity);
}
if (!context.IsRequestCompleted && context.RedirectUri != null)
{
string redirectUri = context.RedirectUri;
if (context.Identity == null)
{
// add a redirect hint that sign-in failed in some way
redirectUri = WebUtilities.AddQueryString(redirectUri, "error", "access_denied");
}
Response.Redirect(redirectUri);
context.RequestCompleted();
}
return context.IsRequestCompleted;
}
return false;
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Globalization;
using System.Net.Http;
using Microsoft.Owin;
using Microsoft.Owin.Logging;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler;
using Microsoft.Owin.Security.DataProtection;
using Microsoft.Owin.Security.Infrastructure;
using Owin.Security.Providers.Gitter.Provider;
using Owin.Security.Providers.Properties;
namespace Owin.Security.Providers.Gitter
{
public class GitterAuthenticationMiddleware : AuthenticationMiddleware<GitterAuthenticationOptions>
{
private readonly HttpClient httpClient;
private readonly ILogger logger;
public GitterAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app,
GitterAuthenticationOptions options)
: base(next, options)
{
if (String.IsNullOrWhiteSpace(Options.ClientId))
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
Resources.Exception_OptionMustBeProvided, "ClientId"));
if (String.IsNullOrWhiteSpace(Options.ClientSecret))
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
Resources.Exception_OptionMustBeProvided, "ClientSecret"));
logger = app.CreateLogger<GitterAuthenticationMiddleware>();
if (Options.Provider == null)
Options.Provider = new GitterAuthenticationProvider();
if (Options.StateDataFormat == null)
{
IDataProtector dataProtector = app.CreateDataProtector(
typeof(GitterAuthenticationMiddleware).FullName,
Options.AuthenticationType, "v1");
Options.StateDataFormat = new PropertiesDataFormat(dataProtector);
}
if (String.IsNullOrEmpty(Options.SignInAsAuthenticationType))
Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType();
httpClient = new HttpClient(ResolveHttpMessageHandler(Options))
{
Timeout = Options.BackchannelTimeout,
MaxResponseContentBufferSize = 1024 * 1024 * 10
};
}
private HttpMessageHandler ResolveHttpMessageHandler(GitterAuthenticationOptions options)
{
HttpMessageHandler handler = options.BackchannelHttpHandler ?? new WebRequestHandler();
// If they provided a validator, apply it or fail.
if (options.BackchannelCertificateValidator != null)
{
// Set the cert validate callback
var webRequestHandler = handler as WebRequestHandler;
if (webRequestHandler == null)
{
throw new InvalidOperationException(Resources.Exception_ValidatorHandlerMismatch);
}
webRequestHandler.ServerCertificateValidationCallback = options.BackchannelCertificateValidator.Validate;
}
return handler;
}
/// <summary>
/// Provides the <see cref="T:Microsoft.Owin.Security.Infrastructure.AuthenticationHandler" /> object for processing
/// authentication-related requests.
/// </summary>
/// <returns>
/// An <see cref="T:Microsoft.Owin.Security.Infrastructure.AuthenticationHandler" /> configured with the
/// <see cref="T:Owin.Security.Providers.Gitter.GitterAuthenticationOptions" /> supplied to the constructor.
/// </returns>
protected override AuthenticationHandler<GitterAuthenticationOptions> CreateHandler()
{
return new GitterAuthenticationHandler(httpClient, logger);
}
}
}

View File

@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.DataHandler;
using Owin.Security.Providers.Gitter.Provider;
namespace Owin.Security.Providers.Gitter
{
public class GitterAuthenticationOptions : AuthenticationOptions
{
/// <summary>
/// Initializes a new <see cref="GitterAuthenticationOptions" />
/// </summary>
public GitterAuthenticationOptions()
: base("Gitter")
{
Caption = Constants.DefaultAuthenticationType;
AuthenticationMode = AuthenticationMode.Passive;
CallbackPath = new PathString("/signin-gitter");
BackchannelTimeout = TimeSpan.FromSeconds(60);
Scope = new List<string>();
}
/// <summary>
/// Get or sets the text that the user can display on a sign in user interface.
/// </summary>
public string Caption
{
get { return Description.Caption; }
set { Description.Caption = value; }
}
/// <summary>
/// Determines the permissions granted from the application to Gitter.
/// Options include: identify, read, post, client, and/or admin
/// </summary>
public IList<string> Scope { get; set; }
/// <summary>
/// Gets or sets the Google supplied Client ID
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// Gets or sets the Google supplied Client Secret
/// </summary>
public string ClientSecret { get; set; }
/// <summary>
/// Gets or sets the <see cref="IGitterAuthenticationProvider" /> used in the authentication events
/// </summary>
public IGitterAuthenticationProvider Provider { get; set; }
/// <summary>
/// Gets or sets the type used to secure data handled by the middleware.
/// </summary>
public PropertiesDataFormat StateDataFormat { get; set; }
/// <summary>
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user
/// <see cref="System.Security.Claims.ClaimsIdentity" />.
/// </summary>
public string SignInAsAuthenticationType { get; set; }
/// <summary>
/// Gets or sets timeout value in milliseconds for back channel communications with Google+.
/// </summary>
/// <value>
/// The back channel timeout in milliseconds.
/// </value>
public TimeSpan BackchannelTimeout { get; set; }
/// <summary>
/// The HttpMessageHandler used to communicate with Gitter.
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
/// can be downcast to a WebRequestHandler.
/// </summary>
public HttpMessageHandler BackchannelHttpHandler { get; set; }
/// <summary>
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
/// in back channel communications belong to PayPal.
/// </summary>
/// <value>
/// The pinned certificate validator.
/// </value>
/// <remarks>
/// If this property is null then the default certificate checks are performed,
/// validating the subject name and if the signing chain is a trusted party.
/// </remarks>
public ICertificateValidator BackchannelCertificateValidator { get; set; }
/// <summary>
/// The request path within the application's base path where the user-agent will be returned.
/// The middleware will process this request when it arrives.
/// Default value is "/signin-gitter".
/// </summary>
public PathString CallbackPath { get; set; }
}
}

View File

@@ -0,0 +1,109 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Security.Claims;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Provider;
using Newtonsoft.Json.Linq;
namespace Owin.Security.Providers.Gitter.Provider
{
/// <summary>
/// Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.
/// </summary>
public class GitterAuthenticatedContext : BaseContext
{
/// <summary>
/// Initializes a <see cref="GitterAuthenticatedContext"/>
/// </summary>
/// <param name="context">The OWIN environment</param>
/// <param name="user">The JSON-serialized user</param>
/// <param name="accessToken">Gitter Access token</param>
/// <param name="token_type">Indicates access level of application</param>
public GitterAuthenticatedContext(IOwinContext context, JObject user, string accessToken, string token_type)
: base(context)
{
User = user;
AccessToken = accessToken;
TokenType = token_type;
UserId = TryGetValue(user, "id");
Username = TryGetValue(user, "username");
UserDisplayName = TryGetValue(user, "displayName");
UserUrl = TryGetValue(user, "url");
UserAvatarUrlSmall = TryGetValue(user, "avatarUrlSmall");
UserAvatarUrlMedium = TryGetValue(user, "avatarUrlMedium");
UserGV = TryGetValue(user, "gv");
}
/// <summary>
/// The user GV
/// </summary>
public string UserGV { get; set; }
/// <summary>
/// URL to the medium size avatar
/// </summary>
public string UserAvatarUrlMedium { get; set; }
/// <summary>
/// URL to the small size avatar
/// </summary>
public string UserAvatarUrlSmall { get; set; }
/// <summary>
/// URL to the user
/// </summary>
public string UserUrl { get; set; }
/// <summary>
/// User display name
/// </summary>
public string UserDisplayName { get; set; }
/// <summary>
/// Username
/// </summary>
public string Username { get; set; }
/// <summary>
/// User unique ID
/// </summary>
public string UserId { get; set; }
/// <summary>
/// Gets the Gitter token type
/// </summary>
public string TokenType { get; set; }
/// <summary>
/// Gets the JSON-serialized user
/// </summary>
/// <remarks>
/// Contains the Gitter user
/// </remarks>
public JObject User { get; set; }
/// <summary>
/// Gets the Gitter access token
/// </summary>
public string AccessToken { get; private set; }
/// <summary>
/// Gets the <see cref="ClaimsIdentity"/> representing the user
/// </summary>
public ClaimsIdentity Identity { get; set; }
/// <summary>
/// Gets or sets a property bag for common authentication properties
/// </summary>
public AuthenticationProperties Properties { get; set; }
private static string TryGetValue(JObject user, string propertyName)
{
JToken value;
return user.TryGetValue(propertyName, out value) ? value.ToString() : null;
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Threading.Tasks;
namespace Owin.Security.Providers.Gitter.Provider
{
/// <summary>
/// Default <see cref="IGitterAuthenticationProvider"/> implementation.
/// </summary>
public class GitterAuthenticationProvider : IGitterAuthenticationProvider
{
/// <summary>
/// Initializes a <see cref="GitterAuthenticationProvider"/>
/// </summary>
public GitterAuthenticationProvider()
{
OnAuthenticated = context => Task.FromResult<object>(null);
OnReturnEndpoint = context => Task.FromResult<object>(null);
}
/// <summary>
/// Gets or sets the function that is invoked when the Authenticated method is invoked.
/// </summary>
public Func<GitterAuthenticatedContext, Task> OnAuthenticated { get; set; }
/// <summary>
/// Gets or sets the function that is invoked when the ReturnEndpoint method is invoked.
/// </summary>
public Func<GitterReturnEndpointContext, Task> OnReturnEndpoint { get; set; }
/// <summary>
/// Invoked whenever Google+ succesfully authenticates a user
/// </summary>
/// <param name="context">Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
public virtual Task Authenticated(GitterAuthenticatedContext context)
{
return OnAuthenticated(context);
}
/// <summary>
/// Invoked prior to the <see cref="System.Security.Claims.ClaimsIdentity"/> being saved in a local cookie and the browser being redirected to the originally requested URL.
/// </summary>
/// <param name="context"></param>
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
public virtual Task ReturnEndpoint(GitterReturnEndpointContext context)
{
return OnReturnEndpoint(context);
}
}
}

View File

@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Provider;
namespace Owin.Security.Providers.Gitter.Provider
{
/// <summary>
/// Provides context information to middleware providers.
/// </summary>
public class GitterReturnEndpointContext : ReturnEndpointContext
{
/// <summary>
///
/// </summary>
/// <param name="context">OWIN environment</param>
/// <param name="ticket">The authentication ticket</param>
public GitterReturnEndpointContext(
IOwinContext context,
AuthenticationTicket ticket)
: base(context, ticket)
{
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Threading.Tasks;
namespace Owin.Security.Providers.Gitter.Provider
{
/// <summary>
/// Specifies callback methods which the <see cref="GitterAuthenticationMiddleware"></see> invokes to enable developer control over the authentication process. />
/// </summary>
public interface IGitterAuthenticationProvider
{
/// <summary>
/// Invoked whenever Google+ succesfully authenticates a user
/// </summary>
/// <param name="context">Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
Task Authenticated(GitterAuthenticatedContext context);
/// <summary>
/// Invoked prior to the <see cref="System.Security.Claims.ClaimsIdentity"/> being saved in a local cookie and the browser being redirected to the originally requested URL.
/// </summary>
/// <param name="context"></param>
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
Task ReturnEndpoint(GitterReturnEndpointContext context);
}
}

View File

@@ -144,6 +144,15 @@
<Compile Include="Foursquare\Provider\FoursquareReturnEndpointContext.cs" />
<Compile Include="Foursquare\Provider\IFoursquareAuthenticationProvider.cs" />
<Compile Include="GitHub\Constants.cs" />
<Compile Include="Gitter\Constants.cs" />
<Compile Include="Gitter\GitterAuthenticationExtensions.cs" />
<Compile Include="Gitter\GitterAuthenticationHandler.cs" />
<Compile Include="Gitter\GitterAuthenticationMiddleware.cs" />
<Compile Include="Gitter\GitterAuthenticationOptions.cs" />
<Compile Include="Gitter\Provider\GitterAuthenticatedContext.cs" />
<Compile Include="Gitter\Provider\GitterAuthenticationProvider.cs" />
<Compile Include="Gitter\Provider\GitterReturnEndpointContext.cs" />
<Compile Include="Gitter\Provider\IGitterAuthenticationProvider.cs" />
<Compile Include="HealthGraph\Constants.cs" />
<Compile Include="GitHub\GitHubAuthenticationExtensions.cs" />
<Compile Include="GitHub\GitHubAuthenticationHandler.cs" />

View File

@@ -1,12 +1,18 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
# Visual Studio 14
VisualStudioVersion = 14.0.22823.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OwinOAuthProvidersDemo", "OwinOAuthProvidersDemo\OwinOAuthProvidersDemo.csproj", "{5A438007-0C90-4DAC-BAA1-54A32164067F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Owin.Security.Providers", "Owin.Security.Providers\Owin.Security.Providers.csproj", "{6AD9BA00-1330-426D-8BAE-2D3BC0D976E4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BF6144CD-2B61-456D-9F7E-A899F6DD850A}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

@@ -14,6 +14,7 @@ using Owin.Security.Providers.EveOnline;
using Owin.Security.Providers.Flickr;
using Owin.Security.Providers.Foursquare;
using Owin.Security.Providers.GitHub;
using Owin.Security.Providers.Gitter;
using Owin.Security.Providers.GooglePlus;
using Owin.Security.Providers.GooglePlus.Provider;
using Owin.Security.Providers.HealthGraph;
@@ -238,10 +239,15 @@ namespace OwinOAuthProvidersDemo
//{
// ClientId = "",
// ClientSecret = "",
// TeamId = "" // optional
// TeamId = "IntelliAgent" // optional
//};
//options.Scope.Add("identify");
//app.UseSlackAuthentication(options);
//app.UseGitterAuthentication(
// clientId: "",
// clientSecret: ""
//);
}
}
}

View File

@@ -15,6 +15,7 @@ Provides a set of extra authentication providers for OWIN ([Project Katana](http
- Flickr
- Foursquare
- GitHub
- Gitter
- Google+
- HealthGraph
- Instagram