Compare commits

..

20 Commits

Author SHA1 Message Date
Tommy Parnell
39ed336c4d bump version 2018-11-04 09:09:28 -05:00
Tommy Parnell
6850514ca4 Merge pull request #238 from sprice88/master
Adding Configurable Display type to Salesforce Auth Request
2018-11-04 09:06:19 -05:00
Tommy Parnell
17ae5efa21 Merge pull request #248 from woutervs/master
Discord authenticated context mapping
2018-11-04 09:05:05 -05:00
Wouter Van Speybroeck
b86f2b65d3 Fix verified mapping onto context ignoring case for boolean 2018-10-15 14:58:06 +02:00
Wouter Van Speybroeck
c6586f2809 Merge pull request #1 from TerribleDev/master
Merge base into fork
2018-10-15 14:53:32 +02:00
Tommy Parnell
bc06288ea2 Merge pull request #246 from odahcam/patch-1
Fix main heading markup
2018-08-13 05:55:51 -04:00
Luiz Machado
02fa70bbe3 fix main heading 2018-08-08 16:09:44 -03:00
Tommy Parnell
d5d7c19a30 bump version 2018-06-12 21:58:07 -04:00
Tommy Parnell
05cd9a4fab Merge pull request #239 from pdsrebelo/master
Add a Request Prefix to Options so that we don't rely always on Request.Scheme or Request.Host.
2018-06-12 21:57:30 -04:00
Pedro Rebelo
b4447fa319 Little fix on the logic of the last commit. 2018-06-04 16:49:34 +01:00
Pedro Rebelo
c9dd2cc062 Add a Request Prefix to TwitchAuthenticationOptions so that we don't rely always on Request.Scheme or Request.Host. 2018-06-04 16:33:07 +01:00
sprice88
b64e7e5d3a Merge pull request #1 from sprice88/configurable_DisplayMode
Added Display mode to SalesforceAuthenticationOptions
2018-05-08 22:30:18 +01:00
Steve Price
b34579f54c Added Display mode to SalesforceAuthenticationOptions 2018-05-08 22:28:23 +01:00
Tommy Parnell
22c830dbfb bump version 2018-05-01 19:51:22 -04:00
Tommy Parnell
06457050a8 Merge pull request #236 from JPRuskin/patch-1
Update Steam OpenID Regex to handle HTTPS
2018-05-01 19:50:30 -04:00
James Ruskin
35ea1c9d79 Update Steam OpenID Regex to handle HTTPS
Steam have updated their implementation to return https URIs in claimedID (please see [this thread](https://www.reddit.com/r/Steam/comments/8a7gsu/steam_openid_broken_for_many_websites_fix_inside/)).

The current version of the `_accountIDRegex` does not handle this.

This change should fix this. Arguably, we should not include the option to accept http, as Steam have (seemingly) irrevocably changed this.

This should solve [Issue #234](https://github.com/TerribleDev/OwinOAuthProviders/issues/234).
2018-04-30 11:49:04 +01:00
Tommy Parnell
900c80a98f bump version 2018-04-01 02:25:35 -04:00
Wouter Van Speybroeck
f60e8b5ffa NameIDentifier should use Id from context instead of username (#232) 2018-04-01 02:25:11 -04:00
Tommy Parnell
c74cd15808 bump version 2018-03-06 21:24:46 -05:00
imaleksandr
26a690060a The "v" parameter with version number becomes obligatory for all API requests. An error will be returned if the parameter is not sent. (#228) 2018-03-06 21:24:17 -05:00
12 changed files with 56 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
[![Build status](https://ci.appveyor.com/api/projects/status/gjlkpp86t8dw164f?svg=true)](https://ci.appveyor.com/project/tparnell8/owinoauthproviders)
#OWIN OAuth Providers
# OWIN OAuth Providers
Provides a set of extra authentication providers for OWIN ([Project Katana](http://katanaproject.codeplex.com/)). This project includes providers for:
- OAuth

View File

@@ -15,7 +15,7 @@ PACKAGES = File.expand_path("packages")
TOOLS = File.expand_path("tools")
NUGET = File.expand_path("#{TOOLS}/nuget")
NUGET_EXE = File.expand_path("#{TOOLS}/nuget/nuget.exe")
@version = "2.20.0"
@version = "2.25.0"
PROJECTS = Dir.glob('src/*').select{|dir| File.directory? dir }
desc 'Retrieve things'

View File

@@ -105,7 +105,7 @@ namespace Owin.Security.Providers.Discord
};
if (!string.IsNullOrEmpty(context.Id))
{
context.Identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, context.UserName, XmlSchemaString, Options.AuthenticationType));
context.Identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, context.Id, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserName))
{

View File

@@ -39,7 +39,7 @@ namespace Owin.Security.Providers.Discord.Provider
Discriminator = TryGetValue(user, "discriminator");
Avatar = TryGetValue(user, "avatar");
Email = TryGetValue(user, "email");
Verified = TryGetValue(user, "verified") == "true";
Verified = TryGetValue(user, "verified").ToLowerInvariant() == "true";
}
public string RefreshToken { get; set; }

View File

@@ -195,7 +195,7 @@ namespace Owin.Security.Providers.Salesforce
var authorizationEndpoint = ComposeAuthorizationEndpoint(properties);
authorizationEndpoint =
$"{authorizationEndpoint}?response_type={"code"}&client_id={Options.ClientId}&redirect_uri={HttpUtility.UrlEncode(redirectUri)}&display={"page"}&immediate={false}&state={Uri.EscapeDataString(state)}";
$"{authorizationEndpoint}?response_type={"code"}&client_id={Options.ClientId}&redirect_uri={HttpUtility.UrlEncode(redirectUri)}&display={Options.DisplayMode}&immediate={false}&state={Uri.EscapeDataString(state)}";
if (Options.Scope != null && Options.Scope.Count > 0)
{

View File

@@ -26,6 +26,21 @@ namespace Owin.Security.Providers.Salesforce
public string Environment { get; set; }
}
/// <summary>
/// Options for Display Mode
/// Changes the login and authorization pages display type. Salesforce supports these values.
/// page—Full-page authorization screen(default)
/// popup—Compact dialog optimized for modern web browser popup windows
/// touch—Mobile-optimized dialog designed for modern smartphones, such as Android and iPhone
/// mobile—Mobile-optimized dialog designed for less capable smartphones, such as BlackBerry OS 5
/// </summary>
public enum Display{
page,
popup,
touch,
mobile
}
/// <summary>
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
/// in back channel communications belong to Salesforce.
@@ -110,6 +125,10 @@ namespace Owin.Security.Providers.Salesforce
/// <see cref="System.Security.Claims.ClaimsIdentity" />.
/// </summary>
public string SignInAsAuthenticationType { get; set; }
/// <summary>
/// Gets or sets the display—(Optional)
/// </summary>
public Display DisplayMode { get; set; }
/// <summary>
/// Gets or sets the type used to secure data handled by the middleware.

View File

@@ -10,7 +10,7 @@ namespace Owin.Security.Providers.Steam
{
internal sealed class SteamAuthenticationHandler : OpenIDAuthenticationHandlerBase<SteamAuthenticationOptions>
{
private readonly Regex _accountIDRegex = new Regex(@"^http://steamcommunity\.com/openid/id/(7[0-9]{15,25})$", RegexOptions.Compiled);
private readonly Regex _accountIDRegex = new Regex(@"^https?://steamcommunity\.com/openid/id/(7[0-9]{15,25})$", RegexOptions.Compiled);
private const string UserInfoUri = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={0}&steamids={1}";

View File

@@ -60,8 +60,7 @@ namespace Owin.Security.Providers.Twitch
return new AuthenticationTicket(null, properties);
}
var requestPrefix = Request.Scheme + "://" + Request.Host;
var redirectUri = requestPrefix + Request.PathBase + Options.CallbackPath;
var redirectUri = GetRequestPrefix() + Request.PathBase + Options.CallbackPath;
// Build up the body for the token request
var body = new List<KeyValuePair<string, string>>
@@ -146,9 +145,7 @@ namespace Owin.Security.Providers.Twitch
if (challenge == null) return Task.FromResult<object>(null);
var baseUri =
Request.Scheme +
Uri.SchemeDelimiter +
Request.Host +
GetRequestPrefix() +
Request.PathBase;
var currentUri =
@@ -237,5 +234,12 @@ namespace Owin.Security.Providers.Twitch
return context.IsRequestCompleted;
}
private string GetRequestPrefix()
{
return !String.IsNullOrEmpty(Options.RequestPrefix)
? Options.RequestPrefix
: Request.Scheme + Uri.SchemeDelimiter + Request.Host;
}
}
}

View File

@@ -125,6 +125,11 @@ namespace Owin.Security.Providers.Twitch
/// </summary>
public bool ForceVerify { get; set; }
/// <summary>
/// Gets or sets the Request prefix
/// </summary>
public string RequestPrefix { get; set; }
/// <summary>
/// Initializes a new <see cref="TwitchAuthenticationOptions" />
/// </summary>

View File

@@ -25,7 +25,7 @@ namespace Owin.Security.Providers.VKontakte.Provider
User = user;
AccessToken = accessToken;
Id = TryGetValue(user, "uid");
Id = TryGetValue(user, "id");
var firstName = TryGetValue(user, "first_name");
var lastName = TryGetValue(user, "last_name");
UserName = firstName + " " + lastName;

View File

@@ -61,7 +61,7 @@ namespace Owin.Security.Providers.VKontakte
var state = Options.StateDataFormat.Protect(properties);
var authorizationEndpoint =
$"{Options.Endpoints.AuthorizationEndpoint}?client_id={Uri.EscapeDataString(Options.ClientId)}&redirect_uri={Uri.EscapeDataString(redirectUri)}&scope={Uri.EscapeDataString(scope)}&state={Uri.EscapeDataString(state)}&display={Uri.EscapeDataString(Options.Display)}";
$"{Options.Endpoints.AuthorizationEndpoint}?client_id={Uri.EscapeDataString(Options.ClientId)}&redirect_uri={Uri.EscapeDataString(redirectUri)}&scope={Uri.EscapeDataString(scope)}&state={Uri.EscapeDataString(state)}&display={Uri.EscapeDataString(Options.Display)}&v={Uri.EscapeDataString(Options.ApiVersion)}";
Response.Redirect(authorizationEndpoint);
@@ -156,7 +156,7 @@ namespace Owin.Security.Providers.VKontakte
// Get the VK user
var userRequestUri = new Uri(
$"{Options.Endpoints.UserInfoEndpoint}?access_token={Uri.EscapeDataString(accessToken)}&user_id{userId}");
$"{Options.Endpoints.UserInfoEndpoint}?access_token={Uri.EscapeDataString(accessToken)}&user_id{userId}&v={Uri.EscapeDataString(Options.ApiVersion)}");
var userResponse = await _httpClient.GetAsync(userRequestUri, Request.CallCancelled);
userResponse.EnsureSuccessStatusCode();

View File

@@ -14,6 +14,7 @@ namespace Owin.Security.Providers.VKontakte
private const string UserInfoEndpoint = "https://api.vk.com/method/users.get";
private const string DefaultCallbackPath = "/signin-vkontakte";
private const string DefaultDisplayMode = "page";
private const string DefaultApiVersion = "5.73";
/// <summary>
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
@@ -100,10 +101,18 @@ namespace Owin.Security.Providers.VKontakte
/// </summary>
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
/// <summary>
/// Initializes a new <see cref="VKontakteAuthenticationOptions" />
/// </summary>
public VKontakteAuthenticationOptions()
/// <summary>
/// Default API version. Required.
/// </summary>
/// <remarks>
/// Defaults to 5.73
/// </remarks>
public string ApiVersion { get; set; }
/// <summary>
/// Initializes a new <see cref="VKontakteAuthenticationOptions" />
/// </summary>
public VKontakteAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
Caption = Constants.DefaultAuthenticationType;
@@ -118,6 +127,7 @@ namespace Owin.Security.Providers.VKontakte
TokenEndpoint = TokenEndpoint,
UserInfoEndpoint = UserInfoEndpoint
};
ApiVersion = DefaultApiVersion;
}
}
}