use of com.yubico.webauthn.extension.appid.AppId in project java-webauthn-server by Yubico.
the class RelyingPartyTest method itHasTheseBuilderMethods.
@Test(expected = NullPointerException.class)
public void itHasTheseBuilderMethods() throws InvalidAppIdException {
final AttestationTrustSource attestationTrustSource = new AttestationTrustSource() {
@Override
public TrustRootsResult findTrustRoots(List<X509Certificate> attestationCertificateChain, Optional<ByteArray> aaguid) {
return null;
}
};
RelyingParty.builder().identity(null).credentialRepository(null).origins(Collections.emptySet()).appId(new AppId("https://example.com")).appId(Optional.of(new AppId("https://example.com"))).attestationConveyancePreference(AttestationConveyancePreference.DIRECT).attestationConveyancePreference(Optional.of(AttestationConveyancePreference.DIRECT)).attestationTrustSource(attestationTrustSource).attestationTrustSource(Optional.of(attestationTrustSource)).preferredPubkeyParams(Collections.emptyList()).allowUntrustedAttestation(true).validateSignatureCounter(true);
}
use of com.yubico.webauthn.extension.appid.AppId in project java-webauthn-server by Yubico.
the class Config method computeAppId.
private static Optional<AppId> computeAppId() throws InvalidAppIdException {
final String appId = System.getenv("YUBICO_WEBAUTHN_U2F_APPID");
logger.debug("YUBICO_WEBAUTHN_U2F_APPID: {}", appId);
AppId result = appId == null ? new AppId("https://localhost:8443") : new AppId(appId);
logger.debug("U2F AppId: {}", result.getId());
return Optional.of(result);
}
use of com.yubico.webauthn.extension.appid.AppId in project java-webauthn-server by Yubico.
the class RelyingParty method startAssertion.
public AssertionRequest startAssertion(StartAssertionOptions startAssertionOptions) {
PublicKeyCredentialRequestOptionsBuilder pkcro = PublicKeyCredentialRequestOptions.builder().challenge(generateChallenge()).rpId(identity.getId()).allowCredentials(OptionalUtil.orElseOptional(startAssertionOptions.getUsername(), () -> startAssertionOptions.getUserHandle().flatMap(credentialRepository::getUsernameForUserHandle)).map(un -> new ArrayList<>(credentialRepository.getCredentialIdsForUsername(un)))).extensions(startAssertionOptions.getExtensions().merge(startAssertionOptions.getExtensions().toBuilder().appid(appId).build())).timeout(startAssertionOptions.getTimeout());
startAssertionOptions.getUserVerification().ifPresent(pkcro::userVerification);
return AssertionRequest.builder().publicKeyCredentialRequestOptions(pkcro.build()).username(startAssertionOptions.getUsername()).build();
}
Aggregations