createSAMLProvider method

Future<CreateSAMLProviderResponse> createSAMLProvider({
  1. required String name,
  2. required String sAMLMetadataDocument,
})

Creates an IAM resource that describes an identity provider (IdP) that supports SAML 2.0.

The SAML provider resource that you create with this operation can be used as a principal in an IAM role's trust policy. Such a policy can enable federated users who sign in using the SAML IdP to assume the role. You can create an IAM role that supports Web-based single sign-on (SSO) to the AWS Management Console or one that supports API access to AWS.

When you create the SAML provider resource, you upload a SAML metadata document that you get from your IdP. That document includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that the IdP sends. You must generate the metadata document using the identity management software that is used as your organization's IdP. For more information, see Enabling SAML 2.0 Federated Users to Access the AWS Management Console and About SAML 2.0-based Federation in the IAM User Guide.

May throw InvalidInputException. May throw EntityAlreadyExistsException. May throw LimitExceededException. May throw ServiceFailureException.

Parameter name : The name of the provider to create.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Parameter sAMLMetadataDocument : An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that are received from the IdP. You must generate the metadata document using the identity management software that is used as your organization's IdP.

For more information, see About SAML 2.0-based Federation in the IAM User Guide

Implementation

Future<CreateSAMLProviderResponse> createSAMLProvider({
  required String name,
  required String sAMLMetadataDocument,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(sAMLMetadataDocument, 'sAMLMetadataDocument');
  _s.validateStringLength(
    'sAMLMetadataDocument',
    sAMLMetadataDocument,
    1000,
    10000000,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['Name'] = name;
  $request['SAMLMetadataDocument'] = sAMLMetadataDocument;
  final $result = await _protocol.send(
    $request,
    action: 'CreateSAMLProvider',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateSAMLProviderRequest'],
    shapes: shapes,
    resultWrapper: 'CreateSAMLProviderResult',
  );
  return CreateSAMLProviderResponse.fromXml($result);
}