Amazon.SecurityToken.SAML.StoredProfileSAMLCredentials.GenerateNewCredentials C# (CSharp) 메소드

GenerateNewCredentials() 보호된 메소드

Refresh credentials after expiry. If the role profile is configured to not use the default user identity, an exception is thrown if the UserAuthenticationCallback property has not been set.
protected GenerateNewCredentials ( ) : CredentialsRefreshState
리턴 CredentialsRefreshState
        protected override CredentialsRefreshState GenerateNewCredentials()
        {
            Validate();

            CredentialsRefreshState newState = null;
            var attempts = 0;
            do
            {
                try
                {
                    NetworkCredential userCredential = null;
                    if (!ProfileData.UseDefaultUserIdentity)
                    {
                        var callbackArgs = new CredentialCallbackArgs
                        {
                            UserIdentity = ProfileData.UserIdentity,
                            CustomState = CustomCallbackState,
                            PreviousAuthenticationFailed = attempts > 0
                        };

                        userCredential = RequestUserCredentialCallback(callbackArgs);

                        if (userCredential == null) // user declined to authenticate
                            throw new AuthenticationFailedException("No credentials supplied, credential refresh abandoned");
                    }

                    newState = Authenticate(userCredential, _credentialDuration);
                }
                catch (AuthenticationFailedException)
                {
                    if (attempts < MaxAuthenticationRetries)
                        attempts++;
                    else
                        throw;
                }
            } while (newState == null && attempts < MaxAuthenticationRetries);

            return newState;
        }