Configuration for accessing Amazon CognitoIdentity service
Inheritance: Amazon.Runtime.ClientConfig
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonCognitoIdentityClient Configuration object. 
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="clientConfig">The AmazonCognitoIdentityClient Configuration Object</param>
 public AmazonCognitoIdentityClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonCognitoIdentityConfig clientConfig)
     : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
 {
 }
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with AWS Access Key ID, AWS Secret Key and an
 /// AmazonCognitoIdentityClient Configuration object.
 /// </summary>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="awsSessionToken">AWS Session Token</param>
 /// <param name="clientConfig">The AmazonCognitoIdentityClient Configuration Object</param>
 public AmazonCognitoIdentityClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonCognitoIdentityConfig clientConfig)
     : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with AWS Credentials and an
 /// AmazonCognitoIdentityClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonCognitoIdentityClient Configuration Object</param>
 public AmazonCognitoIdentityClient(AWSCredentials credentials, AmazonCognitoIdentityConfig clientConfig)
     : base(credentials, clientConfig)
 {
 }
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="config">The AmazonCognitoIdentity Configuration Object</param>
 public AmazonCognitoIdentityClient(AmazonCognitoIdentityConfig config)
     : base(FallbackCredentialsFactory.GetCredentials(), config, AuthenticationTypes.User | AuthenticationTypes.Session) { }
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with AWS Credentials and an
 /// AmazonCognitoIdentityClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonCognitoIdentityClient Configuration Object</param>
 public AmazonCognitoIdentityClient(AWSCredentials credentials, AmazonCognitoIdentityConfig clientConfig)
     : base(credentials, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
 /// <summary>
 /// Constructs AmazonCognitoIdentityClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="config">The AmazonCognitoIdentityClient Configuration Object</param>
 public AmazonCognitoIdentityClient(AmazonCognitoIdentityConfig config)
     : base(FallbackCredentialsFactory.GetCredentials(), config) { }
        private CognitoCredential LetUsDealWithTheAWSCognitoIDStuff(String userID)
        {
            String AccessKey = ConfigurationManager.AppSettings["AWSAccessKeyId"];
               String SecretAccessKey = ConfigurationManager.AppSettings["AWSSecretAccessKey"];
               BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(AccessKey, SecretAccessKey);

               AmazonCognitoIdentityConfig config = new AmazonCognitoIdentityConfig();
               config.ServiceURL = "ec2.us-east-1.amazonaws.com";
               config.RegionEndpoint = Amazon.RegionEndpoint.USEast1;

               AmazonCognitoIdentityClient identityClient = new AmazonCognitoIdentityClient(basicAWSCredentials, config);

               GetOpenIdTokenForDeveloperIdentityRequest idRequest = new GetOpenIdTokenForDeveloperIdentityRequest();
               idRequest.IdentityPoolId = "us-east-1:c812ebc0-88e3-44d9-84e4-8e2ac888d19f";

               Dictionary<string, string> userLogins =  new Dictionary<string, string>();
               userLogins.Add("Login.WhatsNowWebService", userID);
               idRequest.Logins = userLogins;

               idRequest.TokenDuration = 60 * 5;
               GetOpenIdTokenForDeveloperIdentityResponse idResp = identityClient.GetOpenIdTokenForDeveloperIdentity(idRequest);

               string cognitoId = idResp.IdentityId;
               string oidToken = idResp.Token;

               CognitoCredential cc = new CognitoCredential();
               cc.CognitoID = cognitoId;
               cc.CognitoToken = oidToken;

               return cc;
        }
 /// <summary>
 /// Create a client for the Amazon CognitoIdentity Service with AWSCredentials and an AmazonCognitoIdentity Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
 /// <returns>An Amazon CognitoIdentity client</returns>
 /// <remarks>
 /// </remarks>
 public static IAmazonCognitoIdentity CreateAmazonCognitoIdentityClient(AWSCredentials credentials, AmazonCognitoIdentityConfig config)
 {
     return new AmazonCognitoIdentityClient(credentials, config);
 }
 /// <summary>
 /// Create a client for the Amazon CognitoIdentity Service with the specified configuration
 /// </summary>
 /// <param name="awsAccessKey">The AWS Access Key associated with the account</param>
 /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc
 /// </param>
 /// <returns>An Amazon CognitoIdentity client</returns>
 /// <remarks>
 /// </remarks>
 public static IAmazonCognitoIdentity CreateAmazonCognitoIdentityClient(
     string awsAccessKey,
     string awsSecretAccessKey, AmazonCognitoIdentityConfig config
     )
 {
     return new AmazonCognitoIdentityClient(awsAccessKey, awsSecretAccessKey, config);
 }
示例#10
0
 /// <summary>
 /// Create a client for the Amazon CognitoIdentity Service with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 /// </summary>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
 /// <returns>An Amazon CognitoIdentity client</returns>
 public static IAmazonCognitoIdentity CreateAmazonCognitoIdentityClient(AmazonCognitoIdentityConfig config)
 {
     return new AmazonCognitoIdentityClient(config);
 }