UsernamePasswordChallenge
public final class UsernamePasswordChallenge : NSObject, ChallengeProtocol
The Username Password challenge prompts the user to re-enter their username and password registered with Access Manager.
-
Initializes a new
UsernamePasswordChallenge
mechanism.Declaration
Swift
required public convenience override init()
-
Initializes a new
UsernamePasswordChallenge
mechanism.Declaration
Swift
required public init(messagePrompt: String)
Parameters
messagePrompt
The message to display in the alert when prompted.
-
The name of the mechanism.
Declaration
Swift
open var name: String { get }
-
The description of the mechanism.
Declaration
Swift
open override var description: String { get }
-
The identifier of the mechanism.
Remark
The identifier value is: urn:ibm:security:authentication:asf:mechanism:password.Declaration
Swift
open var identifier: String { get }
-
The postback URI of the mechanism.
Remark
This value is set in the parse method.Declaration
Swift
open var postbackUri: String
-
The state represents the unique identifier of the machanism request.
Remark
This value is set in the parse method.Declaration
Swift
open var state: String
-
The message to display in the alert when prompted.
Declaration
Swift
open fileprivate(set) var messagePrompt: String
-
Initializes a new challenge mechanism.
Throws
IBMMobileKitError.invalidDataFromServerDeclaration
Swift
public func parse(_ data: [String : Any]) throws -> UsernamePasswordChallenge
Parameters
data
A data object containing JSON data.
Return Value
The instance of
UsernamePasswordChallenge
, otherwisenil
if the data cannot be parsed. -
This method launches an UIAlertController to prompt for the username and password.
Declaration
Swift
open func launchUI(_ viewController: UIViewController, completion: @escaping (_ data: [String:Any], _ error: Error?) -> Void)
Parameters
viewController
The view controller that is presented by this view controller, or one of its ancestors in the view controller hierarchy.
completion
The data to verify represented as an dictionary of String:Any and
Error
object to identify an error. -
This method launches an UIAlertController to prompt for a password.
Declaration
Swift
open func launchUI(_ completion: @escaping (_ data: [String:Any], _ error: Error?) -> Void)
Parameters
completion
The data to verify represented as an dictionary of String:Any and
Error
object to identify an error.