renaming the prefix from incorrect OnShape to the correct Onshape with only the O capitalized
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
internal static class Constants
|
internal static class Constants
|
||||||
{
|
{
|
||||||
public const string DefaultAuthenticationType = "OnShape";
|
public const string DefaultAuthenticationType = "Onshape";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
public static class OnShapeAuthenticationExtensions
|
public static class OnshapeAuthenticationExtensions
|
||||||
{
|
{
|
||||||
public static IAppBuilder UseOnShapeAuthentication(this IAppBuilder app,
|
public static IAppBuilder UseOnshapeAuthentication(this IAppBuilder app,
|
||||||
OnShapeAuthenticationOptions options)
|
OnshapeAuthenticationOptions options)
|
||||||
{
|
{
|
||||||
if (app == null)
|
if (app == null)
|
||||||
throw new ArgumentNullException("app");
|
throw new ArgumentNullException("app");
|
||||||
if (options == null)
|
if (options == null)
|
||||||
throw new ArgumentNullException("options");
|
throw new ArgumentNullException("options");
|
||||||
|
|
||||||
app.Use(typeof(OnShapeAuthenticationMiddleware), app, options);
|
app.Use(typeof(OnshapeAuthenticationMiddleware), app, options);
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IAppBuilder UseOnShapeAuthentication(this IAppBuilder app, string appKey, string appSecret)
|
public static IAppBuilder UseOnshapeAuthentication(this IAppBuilder app, string appKey, string appSecret)
|
||||||
{
|
{
|
||||||
return app.UseOnShapeAuthentication(new OnShapeAuthenticationOptions
|
return app.UseOnshapeAuthentication(new OnshapeAuthenticationOptions
|
||||||
{
|
{
|
||||||
AppKey = appKey,
|
AppKey = appKey,
|
||||||
AppSecret = appSecret
|
AppSecret = appSecret
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
public class OnShapeAuthenticationHandler : AuthenticationHandler<OnShapeAuthenticationOptions>
|
public class OnshapeAuthenticationHandler : AuthenticationHandler<OnshapeAuthenticationOptions>
|
||||||
{
|
{
|
||||||
private const string StateCookie = "_OnShapeState";
|
private const string StateCookie = "_OnshapeState";
|
||||||
private const string XmlSchemaString = "http://www.w3.org/2001/XMLSchema#string";
|
private const string XmlSchemaString = "http://www.w3.org/2001/XMLSchema#string";
|
||||||
private const string TokenEndpoint = "https://partner.dev.onshape.com/oauth/token";
|
private const string TokenEndpoint = "https://partner.dev.onshape.com/oauth/token";
|
||||||
private const string UserInfoEndpoint = "https://partner.dev.onshape.com/api/users/current";
|
private const string UserInfoEndpoint = "https://partner.dev.onshape.com/api/users/current";
|
||||||
@@ -26,7 +26,7 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
private readonly ILogger logger;
|
private readonly ILogger logger;
|
||||||
private readonly HttpClient httpClient;
|
private readonly HttpClient httpClient;
|
||||||
|
|
||||||
public OnShapeAuthenticationHandler(HttpClient httpClient, ILogger logger)
|
public OnshapeAuthenticationHandler(HttpClient httpClient, ILogger logger)
|
||||||
{
|
{
|
||||||
this.httpClient = httpClient;
|
this.httpClient = httpClient;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@@ -76,6 +76,10 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
body.Add(new KeyValuePair<string, string>("client_id", Options.AppKey));
|
body.Add(new KeyValuePair<string, string>("client_id", Options.AppKey));
|
||||||
body.Add(new KeyValuePair<string, string>("client_secret", Options.AppSecret));
|
body.Add(new KeyValuePair<string, string>("client_secret", Options.AppSecret));
|
||||||
|
|
||||||
|
// Request the token
|
||||||
|
//HttpResponseMessage tokenResponse =
|
||||||
|
// await httpClient.PostAsync(TokenEndpoint, new FormUrlEncodedContent(body));
|
||||||
|
|
||||||
// Get token
|
// Get token
|
||||||
var tokenRequest = new HttpRequestMessage(HttpMethod.Post, TokenEndpoint);
|
var tokenRequest = new HttpRequestMessage(HttpMethod.Post, TokenEndpoint);
|
||||||
tokenRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
tokenRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
@@ -90,6 +94,10 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
dynamic response = JsonConvert.DeserializeObject<dynamic>(text);
|
dynamic response = JsonConvert.DeserializeObject<dynamic>(text);
|
||||||
string accessToken = (string)response.access_token;
|
string accessToken = (string)response.access_token;
|
||||||
|
|
||||||
|
// Get the Onshape user
|
||||||
|
//HttpResponseMessage graphResponse = await httpClient.GetAsync(
|
||||||
|
// UserInfoEndpoint + "?access_token=" + Uri.EscapeDataString(accessToken), Request.CallCancelled);
|
||||||
|
|
||||||
string tokenType = (string)response.token_type;
|
string tokenType = (string)response.token_type;
|
||||||
|
|
||||||
var userRequest = new HttpRequestMessage(HttpMethod.Get, UserInfoEndpoint);
|
var userRequest = new HttpRequestMessage(HttpMethod.Get, UserInfoEndpoint);
|
||||||
@@ -102,7 +110,7 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
text = await graphResponse.Content.ReadAsStringAsync();
|
text = await graphResponse.Content.ReadAsStringAsync();
|
||||||
JObject user = JObject.Parse(text);
|
JObject user = JObject.Parse(text);
|
||||||
|
|
||||||
var context = new OnShapeAuthenticatedContext(Context, user, accessToken);
|
var context = new OnshapeAuthenticatedContext(Context, user, accessToken);
|
||||||
context.Identity = new ClaimsIdentity(
|
context.Identity = new ClaimsIdentity(
|
||||||
Options.AuthenticationType,
|
Options.AuthenticationType,
|
||||||
ClaimsIdentity.DefaultNameClaimType,
|
ClaimsIdentity.DefaultNameClaimType,
|
||||||
@@ -202,7 +210,7 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var context = new OnShapeReturnEndpointContext(Context, ticket);
|
var context = new OnshapeReturnEndpointContext(Context, ticket);
|
||||||
context.SignInAsAuthenticationType = Options.SignInAsAuthenticationType;
|
context.SignInAsAuthenticationType = Options.SignInAsAuthenticationType;
|
||||||
context.RedirectUri = ticket.Properties.RedirectUri;
|
context.RedirectUri = ticket.Properties.RedirectUri;
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ using Microsoft.Owin.Security.DataHandler;
|
|||||||
using Microsoft.Owin.Security.DataProtection;
|
using Microsoft.Owin.Security.DataProtection;
|
||||||
using Microsoft.Owin.Security.Infrastructure;
|
using Microsoft.Owin.Security.Infrastructure;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
public class OnShapeAuthenticationMiddleware : AuthenticationMiddleware<OnShapeAuthenticationOptions>
|
public class OnshapeAuthenticationMiddleware : AuthenticationMiddleware<OnshapeAuthenticationOptions>
|
||||||
{
|
{
|
||||||
private readonly HttpClient httpClient;
|
private readonly HttpClient httpClient;
|
||||||
private readonly ILogger logger;
|
private readonly ILogger logger;
|
||||||
|
|
||||||
public OnShapeAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app,
|
public OnshapeAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app,
|
||||||
OnShapeAuthenticationOptions options)
|
OnshapeAuthenticationOptions options)
|
||||||
: base(next, options)
|
: base(next, options)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(Options.AppKey))
|
if (String.IsNullOrWhiteSpace(Options.AppKey))
|
||||||
@@ -24,15 +24,15 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
if (String.IsNullOrWhiteSpace(Options.AppSecret))
|
if (String.IsNullOrWhiteSpace(Options.AppSecret))
|
||||||
throw new ArgumentException("AppSecret must be provided");
|
throw new ArgumentException("AppSecret must be provided");
|
||||||
|
|
||||||
logger = app.CreateLogger<OnShapeAuthenticationMiddleware>();
|
logger = app.CreateLogger<OnshapeAuthenticationMiddleware>();
|
||||||
|
|
||||||
if (Options.Provider == null)
|
if (Options.Provider == null)
|
||||||
Options.Provider = new OnShapeAuthenticationProvider();
|
Options.Provider = new OnshapeAuthenticationProvider();
|
||||||
|
|
||||||
if (Options.StateDataFormat == null)
|
if (Options.StateDataFormat == null)
|
||||||
{
|
{
|
||||||
IDataProtector dataProtector = app.CreateDataProtector(
|
IDataProtector dataProtector = app.CreateDataProtector(
|
||||||
typeof (OnShapeAuthenticationMiddleware).FullName,
|
typeof (OnshapeAuthenticationMiddleware).FullName,
|
||||||
Options.AuthenticationType, "v1");
|
Options.AuthenticationType, "v1");
|
||||||
Options.StateDataFormat = new PropertiesDataFormat(dataProtector);
|
Options.StateDataFormat = new PropertiesDataFormat(dataProtector);
|
||||||
}
|
}
|
||||||
@@ -53,14 +53,14 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// An <see cref="T:Microsoft.Owin.Security.Infrastructure.AuthenticationHandler" /> configured with the
|
/// An <see cref="T:Microsoft.Owin.Security.Infrastructure.AuthenticationHandler" /> configured with the
|
||||||
/// <see cref="T:Owin.Security.Providers.OnShape.OnShapeAuthenticationOptions" /> supplied to the constructor.
|
/// <see cref="T:Owin.Security.Providers.Onshape.OnshapeAuthenticationOptions" /> supplied to the constructor.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
protected override AuthenticationHandler<OnShapeAuthenticationOptions> CreateHandler()
|
protected override AuthenticationHandler<OnshapeAuthenticationOptions> CreateHandler()
|
||||||
{
|
{
|
||||||
return new OnShapeAuthenticationHandler(httpClient, logger);
|
return new OnshapeAuthenticationHandler(httpClient, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpMessageHandler ResolveHttpMessageHandler(OnShapeAuthenticationOptions options)
|
private HttpMessageHandler ResolveHttpMessageHandler(OnshapeAuthenticationOptions options)
|
||||||
{
|
{
|
||||||
HttpMessageHandler handler = options.BackchannelHttpHandler ?? new WebRequestHandler();
|
HttpMessageHandler handler = options.BackchannelHttpHandler ?? new WebRequestHandler();
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ using System.Net.Http;
|
|||||||
using Microsoft.Owin;
|
using Microsoft.Owin;
|
||||||
using Microsoft.Owin.Security;
|
using Microsoft.Owin.Security;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
public class OnShapeAuthenticationOptions : AuthenticationOptions
|
public class OnshapeAuthenticationOptions : AuthenticationOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
|
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
|
||||||
/// in back channel communications belong to OnShape
|
/// in back channel communications belong to Onshape
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The pinned certificate validator.
|
/// The pinned certificate validator.
|
||||||
@@ -21,14 +21,14 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
public ICertificateValidator BackchannelCertificateValidator { get; set; }
|
public ICertificateValidator BackchannelCertificateValidator { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The HttpMessageHandler used to communicate with OnShape.
|
/// The HttpMessageHandler used to communicate with Onshape.
|
||||||
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
|
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
|
||||||
/// can be downcast to a WebRequestHandler.
|
/// can be downcast to a WebRequestHandler.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpMessageHandler BackchannelHttpHandler { get; set; }
|
public HttpMessageHandler BackchannelHttpHandler { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets timeout value in milliseconds for back channel communications with OnShape.
|
/// Gets or sets timeout value in milliseconds for back channel communications with Onshape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The back channel timeout in milliseconds.
|
/// The back channel timeout in milliseconds.
|
||||||
@@ -38,7 +38,7 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The request path within the application's base path where the user-agent will be returned.
|
/// 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.
|
/// The middleware will process this request when it arrives.
|
||||||
/// Default value is "/signin-OnShape".
|
/// Default value is "/signin-Onshape".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PathString CallbackPath { get; set; }
|
public PathString CallbackPath { get; set; }
|
||||||
|
|
||||||
@@ -52,19 +52,19 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the OnShape supplied Application Key
|
/// Gets or sets the Onshape supplied Application Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AppKey { get; set; }
|
public string AppKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the OnShape supplied Application Secret
|
/// Gets or sets the Onshape supplied Application Secret
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AppSecret { get; set; }
|
public string AppSecret { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the <see cref="IOnShapeAuthenticationProvider" /> used in the authentication events
|
/// Gets or sets the <see cref="IOnshapeAuthenticationProvider" /> used in the authentication events
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IOnShapeAuthenticationProvider Provider { get; set; }
|
public IOnshapeAuthenticationProvider Provider { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user
|
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user
|
||||||
@@ -78,10 +78,10 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
|
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new <see cref="OnShapeAuthenticationOptions" />
|
/// Initializes a new <see cref="OnshapeAuthenticationOptions" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnShapeAuthenticationOptions()
|
public OnshapeAuthenticationOptions()
|
||||||
: base("OnShape")
|
: base("Onshape")
|
||||||
{
|
{
|
||||||
Caption = Constants.DefaultAuthenticationType;
|
Caption = Constants.DefaultAuthenticationType;
|
||||||
CallbackPath = new PathString("/oauthRedirect");
|
CallbackPath = new PathString("/oauthRedirect");
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies callback methods which the <see cref="OnShapeAuthenticationMiddleware"></see> invokes to enable developer control over the authentication process. />
|
/// Specifies callback methods which the <see cref="OnshapeAuthenticationMiddleware"></see> invokes to enable developer control over the authentication process. />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IOnShapeAuthenticationProvider
|
public interface IOnshapeAuthenticationProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked whenever OnShape successfully authenticates a user
|
/// Invoked whenever Onshape successfully authenticates a user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
|
/// <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>
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
||||||
Task Authenticated(OnShapeAuthenticatedContext context);
|
Task Authenticated(OnshapeAuthenticatedContext context);
|
||||||
|
|
||||||
/// <summary>
|
/// <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.
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
||||||
Task ReturnEndpoint(OnShapeReturnEndpointContext context);
|
Task ReturnEndpoint(OnshapeReturnEndpointContext context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,20 +8,20 @@ using Microsoft.Owin.Security;
|
|||||||
using Microsoft.Owin.Security.Provider;
|
using Microsoft.Owin.Security.Provider;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.
|
/// Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OnShapeAuthenticatedContext : BaseContext
|
public class OnshapeAuthenticatedContext : BaseContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a <see cref="OnShapeAuthenticatedContext"/>
|
/// Initializes a <see cref="OnshapeAuthenticatedContext"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The OWIN environment</param>
|
/// <param name="context">The OWIN environment</param>
|
||||||
/// <param name="user">The JSON-serialized user</param>
|
/// <param name="user">The JSON-serialized user</param>
|
||||||
/// <param name="accessToken">OnShape Access token</param>
|
/// <param name="accessToken">Onshape Access token</param>
|
||||||
public OnShapeAuthenticatedContext(IOwinContext context, JObject user, string accessToken)
|
public OnshapeAuthenticatedContext(IOwinContext context, JObject user, string accessToken)
|
||||||
: base(context)
|
: base(context)
|
||||||
{
|
{
|
||||||
AccessToken = accessToken;
|
AccessToken = accessToken;
|
||||||
@@ -35,17 +35,17 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
/// Gets the JSON-serialized user
|
/// Gets the JSON-serialized user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Contains the OnShape user obtained from the endpoint https://api.OnShape.com/1/account/info
|
/// Contains the Onshape user obtained from the endpoint https://api.Onshape.com/1/account/info
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public JObject User { get; private set; }
|
public JObject User { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the OnShape OAuth access token
|
/// Gets the Onshape OAuth access token
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string AccessToken { get; private set; }
|
public string AccessToken { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the OnShape user ID
|
/// Gets the Onshape user ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; private set; }
|
public string Id { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default <see cref="IOnShapeAuthenticationProvider"/> implementation.
|
/// Default <see cref="IOnshapeAuthenticationProvider"/> implementation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OnShapeAuthenticationProvider : IOnShapeAuthenticationProvider
|
public class OnshapeAuthenticationProvider : IOnshapeAuthenticationProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a <see cref="OnShapeAuthenticationProvider"/>
|
/// Initializes a <see cref="OnshapeAuthenticationProvider"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OnShapeAuthenticationProvider()
|
public OnshapeAuthenticationProvider()
|
||||||
{
|
{
|
||||||
OnAuthenticated = context => Task.FromResult<object>(null);
|
OnAuthenticated = context => Task.FromResult<object>(null);
|
||||||
OnReturnEndpoint = context => Task.FromResult<object>(null);
|
OnReturnEndpoint = context => Task.FromResult<object>(null);
|
||||||
@@ -20,19 +20,19 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the function that is invoked when the Authenticated method is invoked.
|
/// Gets or sets the function that is invoked when the Authenticated method is invoked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<OnShapeAuthenticatedContext, Task> OnAuthenticated { get; set; }
|
public Func<OnshapeAuthenticatedContext, Task> OnAuthenticated { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the function that is invoked when the ReturnEndpoint method is invoked.
|
/// Gets or sets the function that is invoked when the ReturnEndpoint method is invoked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<OnShapeReturnEndpointContext, Task> OnReturnEndpoint { get; set; }
|
public Func<OnshapeReturnEndpointContext, Task> OnReturnEndpoint { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked whenever OnShape successfully authenticates a user
|
/// Invoked whenever Onshape successfully authenticates a user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
|
/// <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>
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
||||||
public virtual Task Authenticated(OnShapeAuthenticatedContext context)
|
public virtual Task Authenticated(OnshapeAuthenticatedContext context)
|
||||||
{
|
{
|
||||||
return OnAuthenticated(context);
|
return OnAuthenticated(context);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ namespace Owin.Security.Providers.OnShape
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
||||||
public virtual Task ReturnEndpoint(OnShapeReturnEndpointContext context)
|
public virtual Task ReturnEndpoint(OnshapeReturnEndpointContext context)
|
||||||
{
|
{
|
||||||
return OnReturnEndpoint(context);
|
return OnReturnEndpoint(context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ using Microsoft.Owin;
|
|||||||
using Microsoft.Owin.Security;
|
using Microsoft.Owin.Security;
|
||||||
using Microsoft.Owin.Security.Provider;
|
using Microsoft.Owin.Security.Provider;
|
||||||
|
|
||||||
namespace Owin.Security.Providers.OnShape
|
namespace Owin.Security.Providers.Onshape
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides context information to middleware providers.
|
/// Provides context information to middleware providers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OnShapeReturnEndpointContext : ReturnEndpointContext
|
public class OnshapeReturnEndpointContext : ReturnEndpointContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">OWIN environment</param>
|
/// <param name="context">OWIN environment</param>
|
||||||
/// <param name="ticket">The authentication ticket</param>
|
/// <param name="ticket">The authentication ticket</param>
|
||||||
public OnShapeReturnEndpointContext(
|
public OnshapeReturnEndpointContext(
|
||||||
IOwinContext context,
|
IOwinContext context,
|
||||||
AuthenticationTicket ticket)
|
AuthenticationTicket ticket)
|
||||||
: base(context, ticket)
|
: base(context, ticket)
|
||||||
|
|||||||
@@ -223,15 +223,15 @@
|
|||||||
<Compile Include="LinkedIn\Provider\LinkedInAuthenticationProvider.cs" />
|
<Compile Include="LinkedIn\Provider\LinkedInAuthenticationProvider.cs" />
|
||||||
<Compile Include="LinkedIn\Provider\LinkedInReturnEndpointContext.cs" />
|
<Compile Include="LinkedIn\Provider\LinkedInReturnEndpointContext.cs" />
|
||||||
<Compile Include="LinkedIn\Provider\ILinkedInAuthenticationProvider.cs" />
|
<Compile Include="LinkedIn\Provider\ILinkedInAuthenticationProvider.cs" />
|
||||||
<Compile Include="OnShape\Constants.cs" />
|
<Compile Include="Onshape\Constants.cs" />
|
||||||
<Compile Include="OnShape\OnShapeAuthenticationExtensions.cs" />
|
<Compile Include="Onshape\OnShapeAuthenticationExtensions.cs" />
|
||||||
<Compile Include="OnShape\OnShapeAuthenticationHandler.cs" />
|
<Compile Include="Onshape\OnShapeAuthenticationHandler.cs" />
|
||||||
<Compile Include="OnShape\OnShapeAuthenticationMiddleware.cs" />
|
<Compile Include="Onshape\OnShapeAuthenticationMiddleware.cs" />
|
||||||
<Compile Include="OnShape\OnShapeAuthenticationOptions.cs" />
|
<Compile Include="Onshape\OnShapeAuthenticationOptions.cs" />
|
||||||
<Compile Include="OnShape\Provider\IOnShapeAuthenticationProvider.cs" />
|
<Compile Include="Onshape\Provider\IOnShapeAuthenticationProvider.cs" />
|
||||||
<Compile Include="OnShape\Provider\OnShapeAuthenticatedContext.cs" />
|
<Compile Include="Onshape\Provider\OnShapeAuthenticatedContext.cs" />
|
||||||
<Compile Include="OnShape\Provider\OnShapeAuthenticationProvider.cs" />
|
<Compile Include="Onshape\Provider\OnShapeAuthenticationProvider.cs" />
|
||||||
<Compile Include="OnShape\Provider\OnShapeReturnEndpointContext.cs" />
|
<Compile Include="Onshape\Provider\OnShapeReturnEndpointContext.cs" />
|
||||||
<Compile Include="OpenID\Constants.cs" />
|
<Compile Include="OpenID\Constants.cs" />
|
||||||
<Compile Include="OpenID\Extensions\OpenIDSimpleRegistrationAuthenticationContextExtensions.cs" />
|
<Compile Include="OpenID\Extensions\OpenIDSimpleRegistrationAuthenticationContextExtensions.cs" />
|
||||||
<Compile Include="OpenID\Extensions\OpenIDSimpleRegistrationExtension.cs" />
|
<Compile Include="OpenID\Extensions\OpenIDSimpleRegistrationExtension.cs" />
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ using Owin.Security.Providers.Yahoo;
|
|||||||
using Owin.Security.Providers.Backlog;
|
using Owin.Security.Providers.Backlog;
|
||||||
using Owin.Security.Providers.Vimeo;
|
using Owin.Security.Providers.Vimeo;
|
||||||
using Owin.Security.Providers.Fitbit;
|
using Owin.Security.Providers.Fitbit;
|
||||||
using Owin.Security.Providers.OnShape;
|
using Owin.Security.Providers.Onshape;
|
||||||
|
|
||||||
namespace OwinOAuthProvidersDemo
|
namespace OwinOAuthProvidersDemo
|
||||||
{
|
{
|
||||||
@@ -296,7 +296,7 @@ namespace OwinOAuthProvidersDemo
|
|||||||
// ClientSecret = ""
|
// ClientSecret = ""
|
||||||
//});
|
//});
|
||||||
|
|
||||||
//app.UseOnShapeAuthentication(
|
//app.UseOnshapeAuthentication(
|
||||||
// appKey: "",
|
// appKey: "",
|
||||||
// appSecret: "");
|
// appSecret: "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user