Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »



import com.surepassid.server.task.SurePassServerTask;

public class UafDemoApp extends Application {
@Override
public void onCreate() {
super.onCreate();

SurePassServerTask.setSurePassServer("sandbox.surepassid.com");
SurePassServerTask.setSurePassAccountName("TENANT_ACCOUNT_NAME");
SurePassServerTask.setSurePassAccountKey("TENANT_ACCOUNT_KEY");
}
}



        SurePassIdUaf mUaf = new SurePassIdUaf(this.getActivity());

        /**
         * Used to discover the available authenticators and capabilities.
         */
        mUaf.discover(
                new SurePassIdUaf.DiscoveryCallback() {
                    /**
                     * If the discovery operation was successful, the discoveryData is returned.
                     *
                     * @param discoveryData As defined in the FIDO UAF Application API and
                     *                     Transport Binding Specification
                     */
                    @Override
                    public void onDiscoveryResult(DiscoveryData discoveryData) {

                    }
                },
                new SurePassIdUaf.ErrorCallback() {
                    /**
                     * If this operation failed, the appropriate ErrorCode is returned.
                     *
                     * @param errorCode ErrorCode as defined in the FIDO UAF Application API and
                     *                  Transport Binding Specification
                     */
                    @Override
                    public void onErrorResult(UafClientErrorCode errorCode) {

                    }
                }
        );

        /**
         * Register a new UAF authenticator for the current user.
         */
        mUaf.processRegistration(
                new SurePassIdUaf.ErrorCallback() {
                    /**
                     * This operation always triggers the error callback and return NO_ERROR if the
                     * registration was successful. Otherwise, the appropriate ErrorCode is returned.
                     *
                     * If the registration was successful, the sessionToken obtained from validate
                     * user is invalidated. The user must re-authenticate via UAF.processAuthentication.
                     *
                     * @param errorCode ErrorCode as defined in the FIDO UAF Application API and
                     *                  Transport Binding Specification
                     */
                    @Override
                    public void onErrorResult(UafClientErrorCode errorCode) {

                    }
                }
        );

        /**
         * Perform a UAF Authentication operation.
         */
        mUaf.processAuthentication(
                new SurePassIdUaf.AuthenticationCallback() {
                    /**
                     * If the authentication operation was successful, the session token is returned.
                     *
                     * @param sessionToken
                     */
                    @Override
                    public void onAuthenticationResult(String sessionToken) {

                    }
                },
                new SurePassIdUaf.ErrorCallback() {
                    /**
                     * If this operation failed, the appropriate ErrorCode is returned.
                     *
                     * @param errorCode ErrorCode as defined in the FIDO UAF Application API and
                     *                  Transport Binding Specification
                     */
                    @Override
                    public void onErrorResult(UafClientErrorCode errorCode) {

                    }
                }
        );

        /**
         * Perform a UAF Transaction Confirmation operation.
         *
         * TODO: This may require a parameter to specify the desired transaction.
         */
        mUaf.processTransactionConfirmation(
                new SurePassIdUaf.ErrorCallback() {
                    /**
                     * This operation always triggers the error callback and return NO_ERROR if the
                     * transaction confirmation was successful. Otherwise, the appropriate
                     * ErrorCode is returned.
                     *
                     * @param errorCode ErrorCode as defined in the FIDO UAF Application API and
                     *                  Transport Binding Specification
                     */
                    @Override
                    public void onErrorResult(UafClientErrorCode errorCode) {

                    }
                }
        );

        /**
         * Used to deregister UAF Authenticators.
         */
        mUaf.processDeregistration(
                new SurePassIdUaf.ErrorCallback() {
                    /**
                     * This operation always triggers the error callback and return NO_ERROR if the
                     * transaction confirmation was successful. Otherwise, the appropriate
                     * ErrorCode is returned.
                     *
                     * @param errorCode ErrorCode as defined in the FIDO UAF Application API and
                     *                  Transport Binding Specification
                     */
                    @Override
                    public void onErrorResult(UafClientErrorCode errorCode) {

                    }
                }
        );

  • No labels