다음은 현재 상황입니다. 두 개의 RP 웹 응용 프로그램이 연결된 ADFS 2.0 서버를 설정했습니다. 이러한 응용 프로그램 인 App1과 App2는 웹 API 백엔드가있는 웹 응용 프로그램입니다. Javascript AJAX 호출이 사용됩니다.ADFS로 Thinktecture 웹 API 보안 이해
WIF에 대한 처음 이해에서 브라우저를 통해 로그인 한 다음 두 응용 프로그램에 액세스 할 수 있다고 생각했습니다. App1에서 App2의 웹 API 함수를 호출 할 수 없으므로 잘못된 것으로 판명되었습니다. 이 작업을 수행 할 수있는 유일한 방법은 App2의 URL을 입력하는 것입니다. 그러면 App 1의 후속 호출이 작동합니다 (올바른 FedAuth 쿠키가 헤더에 전달됨).
그래서 검색 및 검색 중입니다. 실제로 App2의 웹 API를 App1에서 호출하는 방법은 있지만 빈 손으로 왔습니다. 내가 솔루션에있어 가장 가까운 것은 내가 제대로이 문제를 이해한다면, 나는 WebAPI 내 SAML2를받을 수 있도록 할 수 있어야한다
이 예에서와 같이, 메시지 처리기를 추가하여 (내가 믿는)입니다 보안 토큰.
내 코드는 다음과 같다 :
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
var authentication = CreateAuthenticationConfiguration();
config.MessageHandlers.Add(new AuthenticationHandler(authentication));
}
}
private static AuthenticationConfiguration CreateAuthenticationConfiguration()
{
System.Diagnostics.Debugger.Break();
var authentication = new AuthenticationConfiguration
{
ClaimsAuthenticationManager = new MyClaimsAuthenticationManager(),
EnableSessionToken = true,
RequireSsl = false
};
authentication.AddSaml2(
issuerThumbprint: **Hidden**,
issuerName: "https://192.168.0.55/adfs/ls/",
audienceUri: "http://localhost/MyCompany.App2/",
certificateValidator: X509CertificateValidator.None,
options: AuthenticationOptions.ForAuthorizationHeader("AdfsSaml"),
scheme: AuthenticationScheme.SchemeOnly("AdfsSaml"));
return authentication;
}
통화가 MyClaimsAuthenticationManager.Authenticate을()에 도달, 그러나 IncomingPrincipal는 아직 인증되지 않습니다.
1) 내 앱 2 웹 API를 호출 할 수 있습니다 : 나는 MyClaimsAuthenticationManager.Authenticate()
내 질문하기 전에 아무것도를 디버깅 할 수 없기 때문에이하는 SAML2 토큰을 수신 여부를 알 수있는 방법이 없습니다 App1에서 인증 받았음에도 불구하고 기능이 있습니까? (그들은 동일한 ADFS를 사용합니다)
2) 가능한 경우 ThinkTecture AuthenticationHandler를 사용하여 올바른 트랙을 수행합니까?
감사합니다.
사용자가 App1에 인증되어 있기 때문입니다. App1은 사용자를 대신하여 App2에 액세스하려고 시도하고 있습니다.Ajax를 App1의 클라이언트에서 App2로 호출하면 작동 할 것입니다. 귀하의 경우에는 App1에서 App2로 사용자의 ID를 위임해야합니다. –
그것은 작동하지 않는다, 그것은 App 2에 필요한 FedAuth 쿠키를 가지고 있지 않다. 그래서 호출은 권한이 없거나/로그인 페이지로 리다이렉트되었다. – Sdupere