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 4
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");
}
}
import com.surepassid.fido.uaf.application.SurePassIdUaf;
import com.surepassid.fido.uaf.client.UafClientErrorCode;
import com.surepassid.fido.uaf.client.UafClientIntent;
public class UafRegistrationFragment extends Fragment {
private SurePassIdUaf mUaf;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.uaf_register_fragment, container, false);
final Button button = view.findViewById(R.id.uaf_register_button);
button.setOnClickListener(v -> {
/**
* 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) {
}
}
);
});
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mUaf = new SurePassIdUaf(this.getActivity());
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case UafClientIntent.REQUEST_CODE_UAF_OPERATION:
// Forward the result to SurePassIdUaf.onActivityResult
mUaf.onActivityResult(requestCode, resultCode, intent);
break;
}
}
}
import com.surepassid.fido.uaf.application.SurePassIdUaf;
import com.surepassid.fido.uaf.client.UafClientErrorCode;
import com.surepassid.fido.uaf.client.UafClientIntent;
public class UafAuthenticationFragment extends Fragment {
private SurePassIdUaf mUaf;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.uaf_authenticate_fragment, container, false);
final Button button = view.findViewById(R.id.uaf_authenticate_button);
button.setOnClickListener(v -> {
/**
* 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) {
}
}
);
});
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mUaf = new SurePassIdUaf(this.getActivity());
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case UafClientIntent.REQUEST_CODE_UAF_OPERATION:
// Forward the result to SurePassIdUaf.onActivityResult
mUaf.onActivityResult(requestCode, resultCode, intent);
break;
}
}
}
import com.surepassid.fido.uaf.application.SurePassIdUaf;
import com.surepassid.fido.uaf.client.UafClientErrorCode;
import com.surepassid.fido.uaf.client.UafClientIntent;
public class UafTransactionConfirmationFragment extends Fragment {
private SurePassIdUaf mUaf;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.uaf_transaction_fragment, container, false);
final Button button = view.findViewById(R.id.uaf_transaction_button);
button.setOnClickListener(v -> {
/**
* 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) {
}
}
);
});
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mUaf = new SurePassIdUaf(this.getActivity());
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case UafClientIntent.REQUEST_CODE_UAF_OPERATION:
// Forward the result to SurePassIdUaf.onActivityResult
mUaf.onActivityResult(requestCode, resultCode, intent);
break;
}
}
}
import com.surepassid.fido.uaf.application.SurePassIdUaf;
import com.surepassid.fido.uaf.client.UafClientErrorCode;
import com.surepassid.fido.uaf.client.UafClientIntent;
public class UafDeregistrationFragment extends Fragment {
private SurePassIdUaf mUaf;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.uaf_deregister_fragment, container, false);
final Button button = view.findViewById(R.id.uaf_deregister_button);
button.setOnClickListener(v -> {
/**
* 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) {
}
}
);
});
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mUaf = new SurePassIdUaf(this.getActivity());
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case UafClientIntent.REQUEST_CODE_UAF_OPERATION:
// Forward the result to SurePassIdUaf.onActivityResult
mUaf.onActivityResult(requestCode, resultCode, intent);
break;
}
}
}