001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * bstefanescu 011 */ 012package org.nuxeo.runtime.api.login; 013 014import java.security.Principal; 015 016/** 017 * Authenticate the given username against the given password. 018 * <p> 019 * This service should be exposed by a user manager framework implementation. 020 * 021 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 022 */ 023public interface Authenticator { 024 025 /** 026 * Get a principal object for the given username if the username / password pair is valid, otherwise returns null. 027 * <p> 028 * This method is doing the authentication of the given username / password pair and returns the corresponding 029 * principal object if authentication succeeded otherwise returns null. 030 * 031 * @param name 032 * @param password 033 * @return the authenticated principal if authentication succeded otherwise null 034 */ 035 public Principal authenticate(String name, String password); 036 037 /** 038 * Check the password for the given username. Returns true if the username / password pair match, false otherwise. 039 * 040 * @param name the username 041 * @param password the password to check 042 * @return true is valid, false otherwise 043 */ 044 public boolean checkUsernamePassword(String name, String password); 045 046}