.append(env.method().toLowerCase()) .append(" ") .append(env.path().orElse("/"))
private AuthenticationResponse challenge(SecurityEnvironment env, String description) { return AuthenticationResponse.builder() .responseHeader("WWW-Authenticate", "Signature realm=\"" + realm + ",headers=\"" + headersForMethod(env.method()) + "\"") .status(SecurityResponse.SecurityStatus.FAILURE) .statusCode(401) .description(description) .build(); }
try { token = DigestToken.fromAuthorizationHeader(headerValue.substring(DIGEST_PREFIX.length()), env.method().toLowerCase()); } catch (HttpAuthException e) { LOGGER.log(Level.FINEST, "Failed to process digest token", e);
outboundDefinition.algorithm(), outboundDefinition.signedHeadersConfig() .headers(env.method(), env.headers()));
private AuthenticationResponse validateSignature(SecurityEnvironment env, HttpSignature httpSignature, InboundClientDefinition clientDefinition) { // validate algorithm Optional<String> validationResult = httpSignature.validate(env, clientDefinition, inboundRequiredHeaders.headers(env.method(), env.headers())); if (validationResult.isPresent()) { return AuthenticationResponse.failed(validationResult.get()); } Principal principal = Principal.builder() .name(clientDefinition.principalName()) .addAttribute(ATTRIB_NAME_KEY_ID, clientDefinition.keyId()) .build(); Subject subject = Subject.builder() .principal(principal) .build(); if (clientDefinition.subjectType() == SubjectType.USER) { return AuthenticationResponse.success(subject); } else { return AuthenticationResponse.successService(subject); } }