Amazon.SecurityToken.SAML.SAMLAuthenticationController.GetSAMLAssertion C# (CSharp) 메소드

GetSAMLAssertion() 공개 메소드

Authenticates the specified network credentials with a provider endpoint and returns the SAML assertion data from which temporary AWS credentials can be obtained.
public GetSAMLAssertion ( Uri identityProviderUrl, ICredentials credentials, string authenticationType ) : SAMLAssertion
identityProviderUrl System.Uri The authentication endpoint to be called.
credentials ICredentials /// Credentials for the call. If null, the users default network credentials will be used /// in a temporary impersonation context. ///
authenticationType string /// The authentication type expected by the endpoint. The default value if not specified /// is 'Kerberos'. Valid values are 'NTLM', 'Digest', 'Kerberos' and 'Negotiate'. ///
리턴 SAMLAssertion
        public SAMLAssertion GetSAMLAssertion(Uri identityProviderUrl, 
                                              ICredentials credentials, 
                                              string authenticationType)
        {
            var response = AuthenticationController.Authenticate(identityProviderUrl, 
                                                                 credentials,
                                                                 string.IsNullOrEmpty(authenticationType) 
                                                                    ? SAMLEndpointSettings.DefaultAuthenticationType : authenticationType,
                                                                 ProxySettings);
            return ResponseParser.Parse(response);
        }
    }

Same methods

SAMLAuthenticationController::GetSAMLAssertion ( string identityProviderUrl, ICredentials credentials, string authenticationType ) : SAMLAssertion

Usage Example

        SAMLImmutableCredentials ICoreAmazonSTS.CredentialsFromSAMLAuthentication(string endpoint,
                                                                                  string authenticationType,
                                                                                  string roleARN,
                                                                                  TimeSpan credentialDuration,
                                                                                  ICredentials userCredential)
        {
            SAMLAssertion assertion;

            try
            {
                var authController = new SAMLAuthenticationController(Config.GetWebProxy());
                assertion = authController.GetSAMLAssertion(endpoint, userCredential, authenticationType);
            }
            catch (Exception e)
            {
                throw new FederatedAuthenticationFailureException("Authentication failure, unable to obtain SAML assertion.", e);
            }

            try
            {
                return assertion.GetRoleCredentials(this, roleARN, credentialDuration);
            }
            catch (Exception e)
            {
                throw new AmazonClientException("Credential generation failed following successful authentication.", e);
            }
        }