SecurityCheckChallengeHandler class
Abstract base class for the IBM MobileFirst Platform security check challenge handler. You must extend it to handle challenges sent by a security check.
Example registering UserLoginCH
challenge handler class for a UserLogin
security check:
class UserLoginChallengeHandler extends SecurityCheckChallengeHandler {
UserLoginChallengeHandler() : super(securityCheck: 'UserLogin');
@override
void handleChallenge(Map challenge) {
// Handle challenge
Map credentials = new Map();
credentials'username'
= 'admin';
credentials'password'
= 'admin';
if (credentials != null) {
this.submitChallengeAnswer(answer: credentials);
} else {
this.cancel();
}
}
@override void handleSuccess(Map success) { // Handle success. Perhaps show a success message or do nothing. }
@override void handleFailure(Map error) { // Handle failure. Perhaps, show a failure message or ask for credentials again. } }
UserLoginChallengeHandler ch = new UserLoginChallengeHandler(); client.registerChallengeHandler(challengeHandler: ch);
Constructors
- SecurityCheckChallengeHandler({@required String securityCheck})
- Constructs an SecurityCheckChallengeHandler for a specific security check.
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- securityCheck → String
-
Returns the name of the security check
read-only
Methods
-
cancel(
) → dynamic - Calling this method tells MobileFirst Platform that the challenge that you no longer want to take any actions to attempt to resolve the challenge. This method returns control to MobileFirst Platform for further handling. For example, call this method when the user clicks on a cancel button.
-
handleChallenge(
Map challenge) → void -
You must implement this method to handle the challenge logic, for example to display the login screen.
The framework will only call this method with
challenge
if it is determined that this challenge handler is a match for this challenge. -
handleFailure(
Map error) → void - This method is called when the MobileFirst Platform Server reports an authentication failure.
-
handleSuccess(
Map identity) → void - This method is called when the MobileFirst Platform Server reports an authentication success.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
submitChallengeAnswer(
{Map answer}) → dynamic -
Send an
answer
back to the security check that triggered this challenge. The answer must be in Map format. For ex: var answer = new Map(); answer'username'
= 'admin'; answer'password'
= 'admin'; -
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited