use of org.craftercms.profile.api.exceptions.ProfileException in project profile by craftercms.
the class TenantServiceImpl method updateAttributeDefinitions.
@Override
public Tenant updateAttributeDefinitions(final String tenantName, final Collection<AttributeDefinition> attributeDefinitions) throws ProfileException {
Tenant tenant = updateTenant(tenantName, new UpdateCallback() {
@Override
public void doWithTenant(TenantUpdater tenantUpdater) throws ProfileException {
tenantUpdater.updateAttributeDefinitions(attributeDefinitions);
}
});
logger.debug(LOG_KEY_ATTRIBUTE_DEFINITIONS_UPDATED, attributeDefinitions, tenantName);
return tenant;
}
use of org.craftercms.profile.api.exceptions.ProfileException in project profile by craftercms.
the class AbstractProfileRestClientBase method doPostForUpload.
protected <T> T doPostForUpload(String url, MultiValueMap<String, Object> request, Class<T> responseType, Object... uriVariables) throws ProfileException {
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(request, headers);
return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables).getBody();
} catch (RestServiceException e) {
handleRestServiceException(e);
} catch (Exception e) {
handleException(e);
}
return null;
}
use of org.craftercms.profile.api.exceptions.ProfileException in project profile by craftercms.
the class RememberMeManagerImpl method updateRememberMe.
protected void updateRememberMe(String loginId, RequestContext context) throws RememberMeException {
PersistentLogin login;
try {
login = authenticationService.refreshPersistentLoginToken(loginId);
} catch (ProfileException e) {
throw new RememberMeException("Unable to update persistent login '" + loginId + "'", e);
}
logger.debug("Persistent login updated: {}", login);
addRememberMeCookie(serializeLogin(login), context.getResponse());
}
use of org.craftercms.profile.api.exceptions.ProfileException in project profile by craftercms.
the class RememberMeManagerImpl method disableRememberMe.
protected void disableRememberMe(String loginId, RequestContext context) throws RememberMeException {
deleteRememberMeCookie(context.getResponse());
try {
authenticationService.deletePersistentLogin(loginId);
} catch (ProfileException e) {
throw new RememberMeException("Error invalidating persistent login '" + loginId + "'");
}
logger.debug("Persistent login '{}' invalidated", loginId);
}
use of org.craftercms.profile.api.exceptions.ProfileException in project engine by craftercms.
the class ProfileRememberMeServices method logout.
@Override
public void logout(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) {
super.logout(request, response, authentication);
// Needed because the super class expects to work only with the username
String cookie = extractRememberMeCookie(request);
if (authentication != null && isNotEmpty(cookie)) {
String persistentLoginId = decodeCookie(cookie)[0];
try {
authenticationService.deletePersistentLogin(persistentLoginId);
} catch (ProfileException e) {
throw new RememberMeAuthenticationException("Error deleting persistent login " + persistentLoginId, e);
}
}
}
Aggregations