nl.vpro.services.EditorProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of user-domain Show documentation
Show all versions of user-domain Show documentation
Domain classes and interfaces related to accountability, users and organizations.
package nl.vpro.services;
import java.security.Principal;
import java.util.function.Supplier;
import nl.vpro.domain.user.Editor;
/**
* The generic service that can provide new {@link Editor} objects given authentication information.
* @author Michiel Meeuwissen
* @since 5.12
*/
public interface EditorProvider {
/**
* Given a principal load an object representing its details. This may e.g. be a spring security UserDetails object,
* but at least it should supply an {@link Editor} also.
*
* @return An object containing the metadata necessary to create an {@link Editor}. Never null
* @throws RuntimeException if e.g. the user can not be found
*/
Supplier loadDetails(Principal principal);
/**
* Shorthand for {@link #loadDetails(Principal)}.get()
*/
default Editor getEditor(Principal principal) {
return loadDetails(principal).get();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy