use of org.opencastproject.security.impl.jpa.JpaUserReference in project opencast by opencast.
the class JpaUserReferenceProvider method getUsers.
@Override
public Iterator<User> getUsers() {
String orgId = securityService.getOrganization().getId();
List<User> users = new ArrayList<User>();
for (JpaUserReference userRef : findUserReferences(orgId, 0, 0, emf)) {
users.add(userRef.toUser(PROVIDER_NAME));
}
return users.iterator();
}
use of org.opencastproject.security.impl.jpa.JpaUserReference in project opencast by opencast.
the class ConfigurableLoginHandler method existingUserLogin.
/**
* Handle an existing user login.
*
* @param id
* The identity of the user, ideally the Shibboleth persistent unique identifier
* @param request
* The request, for accessing any other Shibboleth variables
*/
@Override
public void existingUserLogin(String id, HttpServletRequest request) {
Organization organization = securityService.getOrganization();
// Load the user reference
JpaUserReference userReference = userReferenceProvider.findUserReference(id, organization.getId());
if (userReference == null) {
throw new IllegalStateException("User reference '" + id + "' was not found");
}
// Update the reference
userReference.setName(extractName(request));
userReference.setEmail(extractEmail(request));
userReference.setLastLogin(new Date());
Set<JpaRole> roles = extractRoles(id, request);
userReference.setRoles(roles);
logger.debug("Shibboleth user '{}' logged in", id);
userReferenceProvider.updateUserReference(userReference);
}
Aggregations