All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.services.EditorProvider Maven / Gradle / Ivy

Go to download

Domain classes and interfaces related to accountability, users and organizations.

There is a newer version: 8.3.1
Show newest version
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