REST 서비스를 호출하는 웹 응용 프로그램을 작성하려고합니다. REST 서비스에는 사용자에 대한 OAuth 토큰이 필요합니다. 사용자의 사용자 이름과 암호를 사용하여 OAuth STS가 유효한 OAuth 토큰을 발행하는 데 사용할 수있는 SAML 토큰 (아래 첫 번째 주장)을 얻을 수 있습니다. 웹 응용 프로그램에 있기 때문에 이미 도메인 (SSO)으로 인증 된 사용자의 사용자 이름과 암호를 묻는 대신 ActAs SAML 토큰을 사용하는 것을 선호합니다. ActAs 토큰을 발급하도록 ADFS 2.0을 구성하면 (아래의 두 번째 주장) 어설 션의 AuthnStatement 부분이 누락됩니다. OAuth STS는 그것에 대해 불평하고 있습니다. 지원 부서에 문의하면 사용자 지정 규칙을 사용하여 AuthnStatement를 어설 션에 포함하도록 ADFS 2.0을 구성해야한다고 말합니다. 이 두 가지 사이의 현재 ADFS 2.0 구성의 유일한 차이점은 위임 권한 부여 탭입니다. 코드의 유일한 차이점은 자격 증명이 사용되며 (실제 사용자 대 위임 된 사용자) RST에서 ActAs 속성을 설정하는 것입니다.ADFS ActAs 토큰이 누락되었습니다. AuthnStatement
이 기능을 포함하도록 ADFS 2.0을 구성하는 방법이 있습니까? 맞춤 규칙이 더 많은 소유권 주장 만 생성하고 AuthnStatement는 소유권 주장이 아니기 때문에 맞춤 규칙이 나에게 도움이 될 것이라고 생각하지 않습니다. 실제 사용자의 사용자 이름과 암호를 사용하여 검색
var rst = new RequestSecurityToken
{
RequestType = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue",
AppliesTo = new EndpointReference("https://rpserver.mydomain.com/sap/bc/sec/oauth2/token"),
KeyType = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer",
TokenType = "urn:oasis:names:tc:SAML:2.0:assertion",
//commented for actual user and uncommented for ActAs
//the token is from the actual user
//ActAs = new SecurityTokenElement(token)
};
SAML 토큰 :
코드 토큰을 생성하는 데 사용.
<Assertion ID="_d7ea7eb9-e9f6-45a8-95e4-76a53c151de5" IssueInstant="2014-06-18T12:49:32.815Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<Issuer>
http://adfsservername.mydomain.com/adfs/services/trust</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<ds:Reference URI="#_d7ea7eb9-e9f6-45a8-95e4-76a53c151de5">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<ds:DigestValue>
G4LDaRLEEgsKa1/kRwFo+X2BWv0z32Mi0QRym5GlteU=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
removed for clarity</ds:SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
removed for clarity</ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:Signature>
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">
USERIDGOESHERE</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData NotOnOrAfter="2014-06-18T12:54:32.815Z" />
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2014-06-18T12:49:32.794Z" NotOnOrAfter="2014-06-18T13:49:32.794Z">
<AudienceRestriction>
<Audience>
https://rpservername.mydomain.com/sap/bc/sec/oauth2/token</Audience>
</AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/claims/CommonName">
<AttributeValue>
USERIDGOESHERE</AttributeValue>
</Attribute>
<Attribute Name="client_id">
<AttributeValue>
MLM_MAT_USER</AttributeValue>
</Attribute>
</AttributeStatement>
<AuthnStatement AuthnInstant="2014-06-18T12:49:32.721Z">
<AuthnContext>
<AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
위임을 사용하여 일반 계정의 사용자 이름과 암호를 사용하여 검색된 SAML 토큰.
<Assertion ID="_23107d88-d82d-4fa8-b12a-a447aeb6d5f2" IssueInstant="2014-06-18T12:26:03.005Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<Issuer>
http://adfsservername.mydomain.com/adfs/services/trust</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<ds:Reference URI="#_23107d88-d82d-4fa8-b12a-a447aeb6d5f2">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<ds:DigestValue>
sKf+1gtkbA9Hbk3H82j9dXf7zlebd3EOcrqlMyygpoY=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
removed for clarity</ds:SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
removed for clarity</ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:Signature>
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">
USERIDGOESHERE</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData NotOnOrAfter="2014-06-18T12:31:03.005Z" />
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2014-06-18T12:26:02.872Z" NotOnOrAfter="2014-06-18T13:26:02.872Z">
<AudienceRestriction>
<Audience>
https://rpservername.mydomain.com/sap/bc/sec/oauth2/token</Audience>
</AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="client_id">
<AttributeValue>
MLM_MAT_USER</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2009/09/identity/claims/actor">
<AttributeValue>
<Actor><Attribute Name="http://schemas.xmlsoap.org/claims/CommonName" xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><AttributeValue>ACTORUSERIDGOESHERE</AttributeValue></Attribute><Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><AttributeValue>ACTORUSERIDGOESHERE</AttributeValue></Attribute><Attribute Name="client_id" xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><AttributeValue>MLM_MAT_USER</AttributeValue></Attribute><Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod" xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><AttributeValue>http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password</AttributeValue></Attribute><Attribute Name="http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant" xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><AttributeValue a:type="tn:dateTime" xmlns:tn="http://www.w3.org/2001/XMLSchema" xmlns:a="http://www.w3.org/2001/XMLSchema-instance">2014-06-18T12:26:02.681Z</AttributeValue></Attribute></Actor></AttributeValue>
</Attribute>
</AttributeStatement>
</Assertion>