

package com.ibm.mobilefirstplatform.clientsdk.android.security.mca.api;

import android.content.Context;

import com.ibm.mobilefirstplatform.clientsdk.android.core.api.Request;
import com.ibm.mobilefirstplatform.clientsdk.android.core.api.ResponseListener;

import org.json.JSONObject;

/**
 * The AuthenticationListener interface should be implemented by application's authentication listeners
 * in order to receive notifications about authentication challenges.
 */
public interface AuthenticationListener {
	/**
	 * Called when authentication challenge was received. The implementor should handle the challenge and call
	 * {@link com.ibm.mobilefirstplatform.clientsdk.android.security.mca.api.AuthenticationContext#submitAuthenticationChallengeAnswer(JSONObject)}
	 * with authentication challenge answer.
	 * @param authContext Authentication context the answer should be sent to
	 * @param challenge Information about authentication challenge.
	 * @param context A {@link Context} object that was passed to
	 * {@link Request#send(Context, ResponseListener)}, which triggered the
	 * authentication challenge.
	 */
	void onAuthenticationChallengeReceived(AuthenticationContext authContext, JSONObject challenge, Context context);

	/**
	 * Called when authentication succeeded.
	 * @param context A {@link Context} object that was passed to
	 * {@link Request#send(Context, ResponseListener)}, which triggered the
	 * authentication challenge.
	 * @param info Extended data describing the authentication success.
	 */
	void onAuthenticationSuccess(Context context, JSONObject info);

	/**
	 * Called when authentication fails.
	 * @param context A {@link Context} object that was passed to
	 * {@link Request#send(Context, ResponseListener)}, which triggered the
	 * authentication challenge.
	 * @param info Extended data describing authentication failure.
	 */
	void onAuthenticationFailure(Context context, JSONObject info);

}
