#614 Standardize the pattern for scope defaults.
This commit is contained in:
parent
297c72aa21
commit
a80c5e6d85
|
|
@ -133,18 +133,18 @@ namespace CookieSample
|
||||||
The MicrosoftAccount service has restrictions that prevent the use of http://localhost:54540/ for test applications.
|
The MicrosoftAccount service has restrictions that prevent the use of http://localhost:54540/ for test applications.
|
||||||
As such, here is how to change this sample to uses http://mssecsample.localhost.this:54540/ instead.
|
As such, here is how to change this sample to uses http://mssecsample.localhost.this:54540/ instead.
|
||||||
|
|
||||||
Edit the Project.json file and replace http://localhost:54540/ with http://mssecsample.localhost.this:54540/.
|
Edit the hosting.json file and add "server.urls": "http://mssecsample.localhost.this:54540/".
|
||||||
|
|
||||||
From an admin command console first enter:
|
From an admin command console first enter:
|
||||||
notepad C:\Windows\System32\drivers\etc\hosts
|
notepad C:\Windows\System32\drivers\etc\hosts
|
||||||
and add this to the file, save, and exit (and reboot?):
|
and add this to the file, save, and exit (and reboot?):
|
||||||
127.0.0.1 MsSecSample.localhost.this
|
127.0.0.1 MsSecSample.localhost.this
|
||||||
|
|
||||||
Then you can choose to run the app as admin (see below) or add the following ACL as admin:
|
[WebListener] Then you can choose to run the app as admin (see below) or add the following ACL as admin:
|
||||||
netsh http add urlacl url=http://mssecsample.localhost.this:54540/ user=[domain\user]
|
netsh http add urlacl url=http://mssecsample.localhost.this:54540/ user=[domain\user]
|
||||||
|
|
||||||
The sample app can then be run via:
|
The sample app can then be run via:
|
||||||
dnx . web
|
dnx web
|
||||||
*/
|
*/
|
||||||
app.UseOAuthAuthentication(new OAuthOptions
|
app.UseOAuthAuthentication(new OAuthOptions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,6 @@ namespace Microsoft.AspNetCore.Authentication.Google
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(options));
|
throw new ArgumentNullException(nameof(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.Scope.Count == 0)
|
|
||||||
{
|
|
||||||
// Google OAuth 2.0 asks for non-empty scope. If user didn't set it, set default scope to
|
|
||||||
// "openid profile email" to get basic user information.
|
|
||||||
// TODO: Should we just add these by default when we create the Options?
|
|
||||||
Options.Scope.Add("openid");
|
|
||||||
Options.Scope.Add("profile");
|
|
||||||
Options.Scope.Add("email");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ namespace Microsoft.AspNetCore.Builder
|
||||||
AuthorizationEndpoint = GoogleDefaults.AuthorizationEndpoint;
|
AuthorizationEndpoint = GoogleDefaults.AuthorizationEndpoint;
|
||||||
TokenEndpoint = GoogleDefaults.TokenEndpoint;
|
TokenEndpoint = GoogleDefaults.TokenEndpoint;
|
||||||
UserInformationEndpoint = GoogleDefaults.UserInformationEndpoint;
|
UserInformationEndpoint = GoogleDefaults.UserInformationEndpoint;
|
||||||
|
Scope.Add("openid");
|
||||||
|
Scope.Add("profile");
|
||||||
|
Scope.Add("email");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,6 @@ namespace Microsoft.AspNetCore.Authentication.MicrosoftAccount
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(options));
|
throw new ArgumentNullException(nameof(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.Scope.Count == 0)
|
|
||||||
{
|
|
||||||
// LiveID requires a scope string, so if the user didn't set one we go for the least possible.
|
|
||||||
// TODO: Should we just add these by default when we create the Options?
|
|
||||||
Options.Scope.Add("wl.basic");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ namespace Microsoft.AspNetCore.Builder
|
||||||
AuthorizationEndpoint = MicrosoftAccountDefaults.AuthorizationEndpoint;
|
AuthorizationEndpoint = MicrosoftAccountDefaults.AuthorizationEndpoint;
|
||||||
TokenEndpoint = MicrosoftAccountDefaults.TokenEndpoint;
|
TokenEndpoint = MicrosoftAccountDefaults.TokenEndpoint;
|
||||||
UserInformationEndpoint = MicrosoftAccountDefaults.UserInformationEndpoint;
|
UserInformationEndpoint = MicrosoftAccountDefaults.UserInformationEndpoint;
|
||||||
|
Scope.Add("wl.basic");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue