view src/main/java/edu/harvard/iq/dataverse/authorization/CredentialsAuthenticationProvider.java @ 13:d3374217e19e

url config for LGMap
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 30 Sep 2015 13:55:57 +0200
parents a50cf11e5178
children
line wrap: on
line source

package edu.harvard.iq.dataverse.authorization;

import java.util.List;

/**
 * An authentication provider that can authenticate users based on a set
 * of credentials, given as a map of strings. This allows the Dataverse application
 * to authenticate the user using an in-app form.
 * 
 * @author michael
 */
public interface CredentialsAuthenticationProvider extends AuthenticationProvider {
    
    static class Credential { 
        private final String title;
        
        /**
         * When {@code true}, the login form will use the secret/password widget rather than the regular text field.
         */
        private final boolean secret;

        public Credential(String title, boolean secret) {
            this.title = title;
            this.secret = secret;
        }
        public Credential(String title) {
            this( title, false); 
        }
       
        public String getTitle() {
            return title;
        }

        public boolean isSecret() {
            return secret;
        }
    }
    
    /**
     * Returns the list of credential required for login, normally username and password.
     * The strings will be used by the application as titles to the text fields, and then
     * as keys in the map passed to {@link #authenticate(java.util.Map)}.
     * 
     * @return the list of credentials required for login.
     */
    List<Credential> getRequiredCredentials();
    
}