use of lombok.SneakyThrows in project cas by apereo.
the class WSFederationValidateRequestController method redirectToIdentityProvider.
@SneakyThrows
private void redirectToIdentityProvider(final WSFederationRequest fedRequest, final HttpServletResponse response, final HttpServletRequest request, final WSFederationRegisteredService service) {
final String serviceUrl = constructServiceUrl(request, response, fedRequest);
LOGGER.debug("Created service url [{}] mapped to [{}]", serviceUrl, service);
final boolean renew = shouldRenewAuthentication(fedRequest, request);
final String initialUrl = CommonUtils.constructRedirectUrl(casProperties.getServer().getLoginUrl(), CasProtocolConstants.PARAMETER_SERVICE, serviceUrl, renew, false);
LOGGER.debug("Redirecting authN request to [{}]", initialUrl);
final AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
authenticationRedirectStrategy.redirect(request, response, initialUrl);
}
use of lombok.SneakyThrows in project instagram-java-scraper by postaddictme.
the class ModelMapper method getUnmarshaller.
@SneakyThrows
protected Unmarshaller getUnmarshaller(String mappingFile) {
Map<String, Object> properties = new HashMap<>();
properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, mappingFile);
properties.put(JAXBContextProperties.MEDIA_TYPE, MediaType.APPLICATION_JSON);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader() == null ? Account.class.getClassLoader() : Thread.currentThread().getContextClassLoader();
JAXBContext jaxbContext = DynamicJAXBContextFactory.createContextFromOXM(classLoader, properties);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, MediaType.APPLICATION_JSON);
return unmarshaller;
}
use of lombok.SneakyThrows in project cas by apereo.
the class DynamoDbTicketRegistryConfiguration method amazonDynamoDbClient.
@RefreshScope
@Bean
@SneakyThrows
public AmazonDynamoDB amazonDynamoDbClient() {
final DynamoDbTicketRegistryProperties dynamoDbProperties = casProperties.getTicket().getRegistry().getDynamoDb();
final AmazonDynamoDbClientFactory factory = new AmazonDynamoDbClientFactory();
return factory.createAmazonDynamoDb(dynamoDbProperties);
}
use of lombok.SneakyThrows in project cas by apereo.
the class AbstractCasWebflowEventResolver method validateEventIdForMatchingTransitionInContext.
/**
* Validate event for transition.
*
* @param eventId the event id
* @param context the context
* @param attributes the attributes
* @return the event
*/
@SneakyThrows
protected Event validateEventIdForMatchingTransitionInContext(final String eventId, final RequestContext context, final Map<String, Object> attributes) {
final AttributeMap<Object> attributesMap = new LocalAttributeMap<>(attributes);
final Event event = new Event(this, eventId, attributesMap);
LOGGER.debug("Resulting event id is [{}]. Locating transitions in the context for that event id...", event.getId());
final TransitionDefinition def = context.getMatchingTransition(event.getId());
if (def == null) {
LOGGER.warn("Transition definition cannot be found for event [{}]", event.getId());
throw new AuthenticationException();
}
LOGGER.debug("Found matching transition [{}] with target [{}] for event [{}] with attributes [{}].", def.getId(), def.getTargetStateId(), event.getId(), event.getAttributes());
return event;
}
use of lombok.SneakyThrows in project cas by apereo.
the class RegisteredServiceMultifactorAuthenticationPolicyEventResolver method resolveEventPerAuthenticationProvider.
/**
* Resolve event per authentication provider event.
*
* @param principal the principal
* @param context the context
* @param service the service
* @return the event
*/
@SneakyThrows
protected Set<Event> resolveEventPerAuthenticationProvider(final Principal principal, final RequestContext context, final RegisteredService service) {
final Collection<MultifactorAuthenticationProvider> providers = flattenProviders(getAuthenticationProviderForService(service));
if (providers != null && !providers.isEmpty()) {
final MultifactorAuthenticationProvider provider = this.multifactorAuthenticationProviderSelector.resolve(providers, service, principal);
LOGGER.debug("Selected multifactor authentication provider for this transaction is [{}]", provider);
if (!provider.isAvailable(service)) {
LOGGER.warn("Multifactor authentication provider [{}] could not be verified/reached.", provider);
return null;
}
final String identifier = provider.getId();
LOGGER.debug("Attempting to build an event based on the authentication provider [{}] and service [{}]", provider, service.getName());
final Event event = validateEventIdForMatchingTransitionInContext(identifier, context, buildEventAttributeMap(principal, service, provider));
return CollectionUtils.wrapSet(event);
}
LOGGER.debug("No multifactor authentication providers could be located for [{}]", service);
return null;
}
Aggregations