RequestSecurityToken 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
보안 토큰을 요청하는 데 사용되는 wst:RequestSecurityToken 요소(RST)를 나타냅니다.
public ref class RequestSecurityToken : System::IdentityModel::Protocols::WSTrust::WSTrustMessage
public class RequestSecurityToken : System.IdentityModel.Protocols.WSTrust.WSTrustMessage
type RequestSecurityToken = class
inherit WSTrustMessage
Public Class RequestSecurityToken
Inherits WSTrustMessage
- 상속
예제
이 항목에서 사용되는 코드 예제는 샘플에서 Custom Token 가져옵니다. 이 샘플에서는 SWT(Simple Web Tokens)를 처리할 수 있는 사용자 지정 클래스를 제공하며 SWT 토큰을 제공할 수 있는 수동 STS의 구현을 포함합니다. STS는 에서 SecurityTokenService파생된 클래스에 의해 구현됩니다. 토큰 발급 파이프라인에서 호출되는 클래스의 SecurityTokenService 많은 메서드는 해당 매개 변수인 경우 개체를 RequestSecurityToken 하나로 사용합니다. WIF에 사용할 수 있는 이 샘플 및 기타 샘플 및 다운로드 위치에 대한 자세한 내용은 WIF 코드 샘플 인덱스(Sample Index)를 참조하세요.
다음 코드 예제에서는 메서드의 구현을 SecurityTokenService.GetScope 보여줍니다. 메서드는 매개 변수 중 하나로 사용하고 RequestSecurityToken 이 매개 변수의 속성은 메서드에서 반환되는 개체의 Scope 속성을 설정하는 데 사용됩니다.
// Certificate Constants
private const string SIGNING_CERTIFICATE_NAME = "CN=localhost";
private const string ENCRYPTING_CERTIFICATE_NAME = "CN=localhost";
private SigningCredentials _signingCreds;
private EncryptingCredentials _encryptingCreds;
// Used for validating applies to address, set to URI used in RP app of application, could also have been done via config
private string _addressExpected = "http://localhost:19851/";
/// <summary>
/// This method returns the configuration for the token issuance request. The configuration
/// is represented by the Scope class. In our case, we are only capable of issuing a token to a
/// single RP identity represented by the _encryptingCreds field.
/// </summary>
/// <param name="principal">The caller's principal</param>
/// <param name="request">The incoming RST</param>
/// <returns></returns>
protected override Scope GetScope(ClaimsPrincipal principal, RequestSecurityToken request)
{
// Validate the AppliesTo address
ValidateAppliesTo( request.AppliesTo );
// Create the scope using the request AppliesTo address and the RP identity
Scope scope = new Scope( request.AppliesTo.Uri.AbsoluteUri, _signingCreds );
if (Uri.IsWellFormedUriString(request.ReplyTo, UriKind.Absolute))
{
if (request.AppliesTo.Uri.Host != new Uri(request.ReplyTo).Host)
scope.ReplyToAddress = request.AppliesTo.Uri.AbsoluteUri;
else
scope.ReplyToAddress = request.ReplyTo;
}
else
{
Uri resultUri = null;
if (Uri.TryCreate(request.AppliesTo.Uri, request.ReplyTo, out resultUri))
scope.ReplyToAddress = resultUri.AbsoluteUri;
else
scope.ReplyToAddress = request.AppliesTo.Uri.ToString() ;
}
// Note: In this sample app only a single RP identity is shown, which is localhost, and the certificate of that RP is
// populated as _encryptingCreds
// If you have multiple RPs for the STS you would select the certificate that is specific to
// the RP that requests the token and then use that for _encryptingCreds
scope.EncryptingCredentials = _encryptingCreds;
return scope;
}
/// <summary>
/// Validates the appliesTo and throws an exception if the appliesTo is null or appliesTo contains some unexpected address.
/// </summary>
/// <param name="appliesTo">The AppliesTo parameter in the request that came in (RST)</param>
/// <returns></returns>
void ValidateAppliesTo(EndpointReference appliesTo)
{
if (appliesTo == null)
{
throw new InvalidRequestException("The appliesTo is null.");
}
if (!appliesTo.Uri.Equals(new Uri(_addressExpected)))
{
throw new InvalidRequestException(String.Format("The relying party address is not valid. Expected value is {0}, the actual value is {1}.", _addressExpected, appliesTo.Uri.AbsoluteUri));
}
}
설명
wst:RequestSecurityToken 요소(메시지)에는 STS(보안 토큰 서비스)에서 보안 토큰을 요청하는 데 사용되는 매개 변수 및 속성이 포함됩니다. 메시지(또는 요소)는 RST로 축약됩니다. 클래스에는 RequestSecurityToken RST의 요소를 나타내는 속성이 포함되어 있습니다. RST는 WS-Trust에서 정의한 요청 바인딩에 해당하는 요청을 구성할 수 있습니다. 예를 들어 발급 바인딩, 갱신 바인딩, 유효성 검사 바인딩 또는 취소 바인딩입니다. 클래스의 많은 속성 RequestSecurityToken 은 이러한 바인딩에 정의된 특정 종류의 요청에만 존재하는 요소에 해당합니다. 특정 RequestSecurityToken 개체가 나타내는 요청의 종류 또는 개체가 나타내는 특정 요청에 있는 매개 변수에 따라 개체의 일부 속성이 될 null수 있습니다.
STS는 wst:RequestSecurityTokenResponse 요소(RSTR)를 포함하는 메시지의 요청에 대한 응답을 반환합니다. 이 메시지는 클래스로 RequestSecurityTokenResponse 표시됩니다.
이 클래스가 나타내는 요소에 대한 자세한 내용은 시나리오에 적용되는 WS-Trust 사양( WS-Trust 2005년 2월, WS-Trust 1.3 또는 WS-Trust 1.4)을 참조하세요.
생성자
| Name | Description |
|---|---|
| RequestSecurityToken() |
RequestSecurityToken 클래스의 새 인스턴스를 초기화합니다. |
| RequestSecurityToken(String, String) |
지정된 요청 형식을 사용하여 클래스의 RequestSecurityToken 새 인스턴스를 초기화합니다. |
| RequestSecurityToken(String) |
지정된 요청 형식을 사용하여 클래스의 RequestSecurityToken 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| ActAs |
요청자가 작동하려는 ID에 대한 보안 토큰을 가져오거나 설정합니다. |
| AdditionalContext |
요청에 대한 추가 컨텍스트 정보를 가져오거나 설정합니다. |
| AllowPostdating |
wst:AllowPostdating 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| AppliesTo |
wsp:AppliesTo 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| AuthenticationType |
wst:AuthenticationType 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| BinaryExchange |
wst:BinaryExchange 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| CancelTarget |
WS-Trust 취소 요청에서 취소할 토큰을 가져오거나 설정합니다. |
| CanonicalizationAlgorithm |
wst:CanonicalizationAlgorithm 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| Claims |
클라이언트(요청자)가 요청한 클레임 유형을 가져옵니다. |
| ComputedKeyAlgorithm |
계산 키가 발급된 토큰에 사용될 때 사용할 원하는 알고리즘을 나타내는 URI를 가져옵니다. |
| Context |
RST 또는 RSTR에서 Context 특성의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| Delegatable |
발급된 토큰을 위임 가능으로 표시해야 하는지 여부를 지정하는 값을 가져오거나 설정합니다. |
| DelegateTo |
발급된 토큰을 위임할 ID를 가져오거나 설정합니다. |
| Encryption |
암호화할 때 사용할 토큰 및 키에 대한 정보를 가져오거나 설정합니다. |
| EncryptionAlgorithm |
wst:EncryptionAlgorithm 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| EncryptWith |
wst:EncryptWith 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| Entropy |
wst:Entropy 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| Forwardable |
발급된 토큰을 전달 가능으로 표시해야 하는지 여부를 지정하는 값을 가져오거나 설정합니다. |
| Issuer |
wst:OnBehalfOf 토큰의 발급자를 가져오거나 설정합니다. |
| KeySizeInBits |
RST(RequestSecurityToken) 메시지 내에서 wst:KeySize 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| KeyType |
RST(RequestSecurityToken) 메시지 내에서 wst:KeyType 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| KeyWrapAlgorithm |
wst:KeyWrapAlgorithm 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| Lifetime |
RST(RequestSecurityToken) 메시지 내에서 wst:Lifetime 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| OnBehalfOf |
요청이 이루어지는 ID를 대신하여 토큰을 가져오거나 설정합니다. |
| Participants |
발급된 토큰을 사용할 권한이 있는 참가자를 가져오거나 설정합니다. |
| ProofEncryption |
증명 토큰을 암호화하는 데 사용할 토큰을 가져오거나 설정합니다. |
| Properties |
개체를 확장할 속성 모음을 가져옵니다. (다음에서 상속됨 OpenObject) |
| Renewing |
WS-Trust 갱신 요청에 대한 갱신 의미 체계를 가져오거나 설정합니다. |
| RenewTarget |
WS-Trust 갱신 요청에서 갱신할 토큰을 가져오거나 설정합니다. |
| ReplyTo |
신뢰 당사자에 회신하는 데 사용할 주소를 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| RequestType |
wst:RequestType 요소를 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| SecondaryParameters |
요청자가 생성자가 아닌 매개 변수를 가져오거나 설정합니다. |
| SignatureAlgorithm |
wst:SignatureAlgorithm 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| SignWith |
wst:SignWith 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| TokenType |
wst:TokenType 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| UseKey |
wst:UseKey 요소의 내용을 가져오거나 설정합니다. (다음에서 상속됨 WSTrustMessage) |
| ValidateTarget |
WS-Trust 유효성 검사 요청에서 유효성을 검사할 토큰을 가져오거나 설정합니다. |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |