Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

If using the default oauth token, we will use the request's host & po…

…rt, rather than rely on the user to specify them for us.
  • Loading branch information...
commit addaa36d8f81ee098b5b2dec8efc3e91e531d60a 1 parent eddc268
@ayende ayende authored
View
5 Raven.Database/Config/InMemoryRavenConfiguration.cs
@@ -254,6 +254,11 @@ private void SetVirtualDirectory()
}
+ public bool UseDefaultOAuthTokenServer
+ {
+ get { return Settings["Raven/OAuthTokenServer"] == null; }
+ }
+
private void SetupOAuth()
{
OAuthTokenServer = Settings["Raven/OAuthTokenServer"] ??
View
14 Raven.Database/Server/Security/OAuth/OAuthRequestAuthorizer.cs
@@ -109,7 +109,19 @@ void WriteAuthorizationChallenge(IHttpContext ctx, int statusCode, string error,
{
if (string.IsNullOrEmpty(Settings.OAuthTokenServer) == false)
{
- ctx.Response.AddHeader("OAuth-Source", Settings.OAuthTokenServer);
+ if (Settings.UseDefaultOAuthTokenServer == false)
+ {
+ ctx.Response.AddHeader("OAuth-Source", Settings.OAuthTokenServer);
+ }
+ else
+ {
+ ctx.Response.AddHeader("OAuth-Source", new UriBuilder(Settings.OAuthTokenServer)
+ {
+ Host = ctx.Request.Url.Host,
+ Port = ctx.Request.Url.Port
+ }.Uri.ToString());
+
+ }
}
ctx.Response.StatusCode = statusCode;
ctx.Response.AddHeader("WWW-Authenticate", string.Format("Bearer realm=\"Raven\", error=\"{0}\",error_description=\"{1}\"", error, errorDescription));
View
2  Raven.Tryouts/Program.cs
@@ -15,6 +15,8 @@ class Program
{
static void Main(string[] args)
{
+ var uri = new Uri("ftp://localhost/");
+ Console.WriteLine(uri.Port);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.