Ejemplo n.º 1
0
        public virtual AuthResponse Authenticate(string username, string password, string relayState = null)
        {
            var authRequest = new AuthRequest {
                Username   = username,
                Password   = password,
                RelayState = relayState
            };

            var response = BaseClient.Post(resourcePath, authRequest.ToJson(), false);

            return(Utils.Deserialize <AuthResponse>(response));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Authenticates an Okta user
        /// </summary>
        /// <param name="username">User's username/login</param>
        /// <param name="password">User's password</param>
        /// <param name="relayState">opaque value for the transaction and processed as untrusted data which is just echoed in a response. It is the client’s responsibility to escape/encode this value before displaying in a UI such as a HTML document </param>
        /// <param name="bWarnPasswordExpired">Optional parameter indicating whether the PASSWORD_WARN status should be returned if available. Defaults to false</param>
        /// <param name="bMultiOptionalFactorEnroll">Optional parameter indicating whether the user should be prompted to add an additional second factor if available </param>
        /// <returns></returns>
        public virtual AuthResponse Authenticate(string username, string password, string relayState = null, bool bWarnPasswordExpired = false, bool bMultiOptionalFactorEnroll = false)
        {
            var authRequest = new AuthRequest {
                Username   = username,
                Password   = password,
                RelayState = relayState,
                Options    =
                {
                    WarnBeforePasswordExpiration = bWarnPasswordExpired,
                    MultiOptionalFactorEnroll    = bMultiOptionalFactorEnroll
                }
            };

            var response = BaseClient.Post(resourcePath, authRequest.ToJson(), false);

            return(Utils.Deserialize <AuthResponse>(response));
        }