Hi
I have new MVC project created using the VS2103 Update 2 RC template with a individual user account authentication method. The web site will sit behind a reverse proxy meaning all usersmust authenticate to the reverse proxy before accessing the site. Once authenticated at the reverse proxy can add a basic authentication header or a custom header that contains the user name. There is no need to authentice the user again in the MVC web app.
I've writtern the following code as the startup class, the claim gets created, but the Register and Sign in links (top right corner of the page) don't update with the authenticated user. Any ideas how to make that happen?
public class Startup { public static void Configuration(IAppBuilder app) { app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/token"), Provider = new OAuthAuthorizationServerProvider() { OnValidateClientAuthentication = async c => { c.Validated(); }, OnGrantResourceOwnerCredentials = async c => {
string username = c.Request.Headers["proxy_user"]; if (!string.IsNullOrEmpty(username) { ClaimsIdentity id = new ClaimsIdentity( new Claim[] { new Claim(ClaimTypes.Name, username) }, OAuthDefaults.AuthenticationType); c.Validated(id); } } } }); } }
thanks