本文整理汇总了Java中org.slf4j.event.Level.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java Level.ERROR属性的具体用法?Java Level.ERROR怎么用?Java Level.ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.slf4j.event.Level
的用法示例。
在下文中一共展示了Level.ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateAuthnRequestFromHub
public SamlMessage generateAuthnRequestFromHub(SessionId sessionId, String principalIpAddress) {
AuthnRequestFromHubContainerDto authnRequestFromHub = sessionProxy.getAuthnRequestFromHub(sessionId);
AuthnRequest request = authnRequestTransformer.apply(authnRequestFromHub.getSamlRequest());
SamlValidationResponse samlSignatureValidationResponse = samlMessageSignatureValidator.validate(request, SPSSODescriptor.DEFAULT_ELEMENT_NAME);
protectiveMonitoringLogger.logAuthnRequest(request, Direction.OUTBOUND, samlSignatureValidationResponse.isOK());
if (!samlSignatureValidationResponse.isOK()) {
SamlValidationSpecificationFailure failure = samlSignatureValidationResponse.getSamlValidationSpecificationFailure();
throw new SamlTransformationErrorException(failure.getErrorMessage(), samlSignatureValidationResponse.getCause(), Level.ERROR);
}
SamlMessage samlMessage = new SamlMessage(authnRequestFromHub.getSamlRequest(), SamlMessageType.SAML_REQUEST, Optional.fromNullable(sessionId.toString()), authnRequestFromHub.getPostEndpoint().toString(), Optional.of(authnRequestFromHub.getRegistering()));
externalCommunicationEventLogger.logIdpAuthnRequest(request.getID(), sessionId, authnRequestFromHub.getPostEndpoint(), principalIpAddress);
return samlMessage;
}
示例2: newCreateAttributeQueryContainer
public uk.gov.ida.hub.samlengine.contracts.AttributeQueryContainerDto newCreateAttributeQueryContainer(final T attributeQueryRequest,
final URI msaUri,
final String matchingServiceEntityId,
final DateTime matchingServiceRequestTimeOut,
boolean onboarding) {
try {
entityToEncryptForLocator.addEntityIdForRequestId(
attributeQueryRequest.getId(),
matchingServiceEntityId);
String samlRequest =
XmlUtils.writeToString(attributeQueryRequestTransformer.apply(attributeQueryRequest));
return new uk.gov.ida.hub.samlengine.contracts.AttributeQueryContainerDto(
attributeQueryRequest.getId(),
attributeQueryRequest.getIssuer(),
samlRequest,
msaUri,
matchingServiceRequestTimeOut,
onboarding);
} catch (Exception e) {
throw new UnableToGenerateSamlException("failed to create attribute query request", e, Level.ERROR);
} finally {
entityToEncryptForLocator.removeEntityIdForRequestId(attributeQueryRequest.getId());
}
}
示例3: handleRequestPost
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Timed
public Response handleRequestPost(SamlRequestDto samlRequestDto) {
relayStateValidator.validate(samlRequestDto.getRelayState());
AuthnRequest authnRequest = stringSamlAuthnRequestTransformer.apply(samlRequestDto.getSamlRequest());
SamlValidationResponse signatureValidationResponse = authnRequestSignatureValidator.validate(authnRequest, SPSSODescriptor.DEFAULT_ELEMENT_NAME);
protectiveMonitoringLogger.logAuthnRequest(authnRequest, Direction.INBOUND, signatureValidationResponse.isOK());
if (!signatureValidationResponse.isOK()) {
SamlValidationSpecificationFailure failure = signatureValidationResponse.getSamlValidationSpecificationFailure();
throw new SamlTransformationErrorException(failure.getErrorMessage(), signatureValidationResponse.getCause(), Level.ERROR);
}
SamlAuthnRequestContainerDto samlAuthnRequestContainerDto = new SamlAuthnRequestContainerDto(samlRequestDto.getSamlRequest(), Optional.ofNullable(samlRequestDto.getRelayState()), samlRequestDto.getPrincipalIpAsSeenByFrontend());
SessionId sessionId = sessionProxy.createSession(samlAuthnRequestContainerDto);
return Response.ok(sessionId).build();
}
示例4: assertionConsumerServiceUrlNotMatching
public static SessionCreationFailureException assertionConsumerServiceUrlNotMatching(
String assertionConsumerUrl,
String configFileUrl,
String issuer
) {
String errorMessage = String.format(
"AssertionConsumerUrl (%s) doesn't match consumer url in config file (%s). Issuer was: %s",
assertionConsumerUrl,
configFileUrl,
issuer
);
return new SessionCreationFailureException(
errorMessage,
Level.ERROR,
ExceptionType.INVALID_ASSERTION_CONSUMER_URL
);
}
示例5: generate
public SamlMessageDto generate(RequestForErrorResponseFromHubDto requestForErrorResponseFromHubDto) {
try {
final OutboundResponseFromHub response = new OutboundResponseFromHub(
requestForErrorResponseFromHubDto.getResponseId(),
requestForErrorResponseFromHubDto.getInResponseTo(),
hubEntityId,
DateTime.now(),
TransactionIdaStatus.valueOf(requestForErrorResponseFromHubDto.getStatus().name()),
empty(),
requestForErrorResponseFromHubDto.getAssertionConsumerServiceUri());
final String errorResponse = outboundResponseFromHubToResponseTransformerFactory.get(requestForErrorResponseFromHubDto.getAuthnRequestIssuerEntityId()).apply(response);
return new SamlMessageDto(errorResponse);
} catch (Exception e) {
throw new UnableToGenerateSamlException("Unable to generate RP error response", e, Level.ERROR);
}
}
示例6: handleResponsePost
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path(Urls.SamlProxyUrls.RESPONSE_POST_PATH)
@Timed
public Response handleResponsePost(SamlRequestDto samlRequestDto) {
final SessionId sessionId = new SessionId(samlRequestDto.getRelayState());
MDC.put("SessionId", sessionId);
relayStateValidator.validate(samlRequestDto.getRelayState());
org.opensaml.saml.saml2.core.Response samlResponse = stringSamlResponseTransformer.apply(samlRequestDto.getSamlRequest());
SamlValidationResponse signatureValidationResponse = authnResponseSignatureValidator.validate(samlResponse, IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
protectiveMonitoringLogger.logAuthnResponse(
samlResponse,
Direction.INBOUND,
signatureValidationResponse.isOK());
if (!signatureValidationResponse.isOK()) {
SamlValidationSpecificationFailure failure = signatureValidationResponse.getSamlValidationSpecificationFailure();
throw new SamlTransformationErrorException(failure.getErrorMessage(), signatureValidationResponse.getCause(), Level.ERROR);
}
final SamlAuthnResponseContainerDto authnResponseDto = new SamlAuthnResponseContainerDto(
samlRequestDto.getSamlRequest(),
sessionId,
samlRequestDto.getPrincipalIpAsSeenByFrontend()
);
return Response.ok(sessionProxy.receiveAuthnResponseFromIdp(authnResponseDto, sessionId)).build();
}
示例7: handleEidasResponsePost
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path(Urls.SamlProxyUrls.EIDAS_RESPONSE_POST_PATH)
@Timed
public Response handleEidasResponsePost(SamlRequestDto samlRequestDto) {
if (eidasAuthnResponseSignatureValidator.isPresent()) {
final SessionId sessionId = new SessionId(samlRequestDto.getRelayState());
MDC.put("SessionId", sessionId);
relayStateValidator.validate(samlRequestDto.getRelayState());
org.opensaml.saml.saml2.core.Response samlResponse = stringSamlResponseTransformer.apply(samlRequestDto.getSamlRequest());
SamlValidationResponse signatureValidationResponse = eidasAuthnResponseSignatureValidator.get().validate(samlResponse, IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
protectiveMonitoringLogger.logAuthnResponse(
samlResponse,
Direction.INBOUND,
signatureValidationResponse.isOK());
if (!signatureValidationResponse.isOK()) {
SamlValidationSpecificationFailure failure = signatureValidationResponse.getSamlValidationSpecificationFailure();
throw new SamlTransformationErrorException(failure.getErrorMessage(), signatureValidationResponse.getCause(), Level.ERROR);
}
final SamlAuthnResponseContainerDto authnResponseDto = new SamlAuthnResponseContainerDto(
samlRequestDto.getSamlRequest(),
sessionId,
samlRequestDto.getPrincipalIpAsSeenByFrontend()
);
return Response.ok(sessionProxy.receiveAuthnResponseFromCountry(authnResponseDto, sessionId)).build();
}
return Response.status(Response.Status.NOT_FOUND).build();
}
示例8: validateRequestSignature
private void validateRequestSignature(Element matchingServiceRequest, URI matchingServiceUri) {
AttributeQuery attributeQuery = elementToAttributeQueryTransformer.apply(matchingServiceRequest);
SamlValidationResponse signatureValidationResponse = matchingRequestSignatureValidator.validate(attributeQuery, AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME);
protectiveMonitoringLogger.logAttributeQuery(attributeQuery.getID(), matchingServiceUri.toASCIIString(), attributeQuery.getIssuer().getValue(), signatureValidationResponse.isOK());
if (!signatureValidationResponse.isOK()) {
SamlValidationSpecificationFailure failure = signatureValidationResponse.getSamlValidationSpecificationFailure();
throw new SamlTransformationErrorException(failure.getErrorMessage(), signatureValidationResponse.getCause(), Level.ERROR);
}
}
示例9: shouldHandleSamlContextExceptionCorrectly
@Test
public void shouldHandleSamlContextExceptionCorrectly() throws Exception {
final SamlContextException exception = new SamlContextException(UUID.randomUUID().toString(), "entityId", new SamlTransformationErrorException("error", Level.ERROR));
Response response = samlEngineExceptionMapper.toResponse(exception);
ErrorStatusDto responseEntity = (ErrorStatusDto) response.getEntity();
assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
assertThat(responseEntity.isAudited()).isFalse();
assertThat(responseEntity.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML);
checkLogLevel(exception.getLogLevel());
}
示例10: toResponse_shouldReturnUnauditedErrorStatus
@Test
public void toResponse_shouldReturnUnauditedErrorStatus() throws Exception {
HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
when(httpServletRequest.getParameter(Urls.SharedUrls.SESSION_ID_PARAM)).thenReturn("42");
StateProcessingValidationExceptionMapper mapper = new StateProcessingValidationExceptionMapper(serviceInfo, eventSinkProxy);
mapper.setHttpServletRequest(httpServletRequest);
StateProcessingValidationException exception = new StateProcessingValidationException("error message", Level.ERROR);
final Response response = mapper.toResponse(exception);
assertThat(response.getEntity()).isNotNull();
ErrorStatusDto errorStatusDto = (ErrorStatusDto)response.getEntity();
assertThat(errorStatusDto.isAudited()).isEqualTo(false);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(ExceptionType.STATE_PROCESSING_VALIDATION);
}
示例11: createAttributeQueryContainer
public SamlMessageDto createAttributeQueryContainer(T attributeQueryRequest, String matchingServiceEntityId) {
String requestId = attributeQueryRequest.getId();
try {
entityToEncryptForLocator.addEntityIdForRequestId(requestId, matchingServiceEntityId);
return new SamlMessageDto(XmlUtils.writeToString(attributeQueryRequestTransformer.apply(attributeQueryRequest)));
} catch (Exception e) {
throw new UnableToGenerateSamlException("failed to create attribute query request", e, Level.ERROR);
} finally {
entityToEncryptForLocator.removeEntityIdForRequestId(requestId);
}
}
示例12: configServiceException
public static SessionCreationFailureException configServiceException(Exception e) {
return new SessionCreationFailureException(e.getMessage(), e, Level.ERROR, ExceptionType.INVALID_ASSERTION_CONSUMER_INDEX);
}
示例13: unavailableIdp
public static StateProcessingValidationException unavailableIdp(String idpEntityId, SessionId sessionId) {
return new StateProcessingValidationException(format("Available Identity Provider for session ID [{0}] not found for entity ID [{1}].", sessionId.getSessionId(), idpEntityId), Level.ERROR);
}
示例14: wrongLevelOfAssurance
public static StateProcessingValidationException wrongLevelOfAssurance(Optional<LevelOfAssurance> loa, List<LevelOfAssurance> expectedLevels) {
return new StateProcessingValidationException(format("Level of assurance in the response does not match level of assurance in the request. Was [{0}] but expected [{1}].", loa.map(LevelOfAssurance::name).orElseGet(() -> "null"), expectedLevels), Level.ERROR);
}
示例15: noLevelOfAssurance
public static StateProcessingValidationException noLevelOfAssurance() {
return new StateProcessingValidationException("No level of assurance in the response.", Level.ERROR);
}