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.
This commit is contained in:
@@ -60,8 +60,7 @@ namespace Owin.Security.Providers.Twitch
|
|||||||
return new AuthenticationTicket(null, properties);
|
return new AuthenticationTicket(null, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
var requestPrefix = Request.Scheme + "://" + Request.Host;
|
var redirectUri = GetRequestPrefix() + Request.PathBase + Options.CallbackPath;
|
||||||
var redirectUri = requestPrefix + Request.PathBase + Options.CallbackPath;
|
|
||||||
|
|
||||||
// Build up the body for the token request
|
// Build up the body for the token request
|
||||||
var body = new List<KeyValuePair<string, string>>
|
var body = new List<KeyValuePair<string, string>>
|
||||||
@@ -146,9 +145,7 @@ namespace Owin.Security.Providers.Twitch
|
|||||||
|
|
||||||
if (challenge == null) return Task.FromResult<object>(null);
|
if (challenge == null) return Task.FromResult<object>(null);
|
||||||
var baseUri =
|
var baseUri =
|
||||||
Request.Scheme +
|
GetRequestPrefix() +
|
||||||
Uri.SchemeDelimiter +
|
|
||||||
Request.Host +
|
|
||||||
Request.PathBase;
|
Request.PathBase;
|
||||||
|
|
||||||
var currentUri =
|
var currentUri =
|
||||||
@@ -237,5 +234,12 @@ namespace Owin.Security.Providers.Twitch
|
|||||||
|
|
||||||
return context.IsRequestCompleted;
|
return context.IsRequestCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetRequestPrefix()
|
||||||
|
{
|
||||||
|
return !String.IsNullOrEmpty(Options.RequestPrefix)
|
||||||
|
? Options.RequestPrefix
|
||||||
|
: Request.Scheme + Uri.SchemeDelimiter + Request.Host;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,6 +125,11 @@ namespace Owin.Security.Providers.Twitch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ForceVerify { get; set; }
|
public bool ForceVerify { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Request prefix
|
||||||
|
/// </summary>
|
||||||
|
public string RequestPrefix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new <see cref="TwitchAuthenticationOptions" />
|
/// Initializes a new <see cref="TwitchAuthenticationOptions" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user