나는 IdentityServer3로 보안을 설정하려고하는 매우 간단한 MVC5 웹 사이트를 가지고 있습니다.왜 IdentityServer가 https가 아닌 http로 리디렉션됩니까?
내 웹 사이트와 내 IdentityServer 인스턴스는 모두 AppHarbor의 별도 사이트로 호스팅됩니다. 두 가지 모두 https 뒤에 있습니다.
[Authorize]
속성 (예 : /Home/About
)으로 보호되는 웹 사이트의 리소스를 클릭하면 성공적으로 IdentityServer로 리디렉션되고 성공적으로 인증 할 수 있습니다.
IdentityServer가 웹 사이트에 대한 응답을 app.FormPostResponse.js
을 통해 다시 게시하면 웹 사이트는 요청 된 자원에 대한 302 리디렉션으로 응답합니다. 그러나 이 리디렉션은 https가 아닌 http입니다 (네트워크 추적은 참조).
이건 내 IdentityServer 구성에 문제가있는 것 같지만 잘못된 점에 대해서는 알려 주시면 감사하겠습니다.
(AppHarbor가 SSL 종료 IIS, 앞에 리버스 프록시 (내가 믿는 nginx를) 사용 -. 그래서 나는 IdentityServer 문서에 따라,이 시나리오 RequireSsl = false
을)를 여기에
내 웹 사이트의 Startup.cs
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = "https://<my-idsrv3>.apphb.com/identity",
ClientId = "<my-client-id>",
Scope = "openid profile roles email",
RedirectUri = "https://<my-website>.apphb.com",
ResponseType = "id_token",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = false
});
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
}
}
내 IdentityServer3 인스턴스에서 Startup.cs입니다 : 여기
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Map("/identity", idsrvApp =>
{
idsrvApp.UseIdentityServer(new IdentityServerOptions
{
SiteName = "My Identity Server",
SigningCertificate = Certificates.LoadSigningCertificate(),
RequireSsl = false,
PublicOrigin = "https://<my-idsrv3>.apphb.com",
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get())
});
});
}
}
내 웹 사이트의 정의입니다 클라이언트 : 여기
new Client
{
Enabled = true,
ClientName = "My Website Client",
ClientId = "<my-client-id>",
Flow = Flows.Implicit,
RedirectUris = new List<string>
{
"https://<my-website>.apphb.com"
},
AllowAccessToAllScopes = true
}
은 크롬에서 추적되면, IdentityServer 동의 화면에서 '예, 허용'을 클릭 한 후이 문제는 내 클라이언트의 웹 사이트에 의한 것처럼