blob: c5f3a5c5d1c6f9efffd6516144e64ac54a63cede [file] [log] [blame]
/*
* Copyright 2005-2008 Jeremy Haile, Les Hazlewood
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jsecurity.authc.credential;
import org.jsecurity.authc.Account;
import org.jsecurity.authc.AuthenticationToken;
/**
* Interface that can be implemented by classes that can determine if an AuthenticationToken's provided
* credentials matches a corresponding account's credentials stored in the system.
*
* <p>As a common example, an implementation of this interface might verify a user-submitted
* text password with a corresponding account password stored in the system.
*
* @see SimpleCredentialsMatcher
* @see AllowAllCredentialsMatcher
* @see Md5CredentialsMatcher
* @see Sha1CredentialsMatcher
*
* @since 0.1
* @author Jeremy Haile
* @author Les Hazlewood
*/
public interface CredentialsMatcher {
/**
* Returns <tt>true</tt> if the provided token credentials match the stored account credentials,
* <tt>false</tt> otherwise.
*
* @param token the <tt>AuthenticationToken</tt> submitted during the authentication attempt
* @param account the <tt>Account</tt> stored in the system.
* @return <tt>true</tt> if the provided token credentials match the stored account credentials,
* <tt>false</tt> otherwise.
*/
boolean doCredentialsMatch( AuthenticationToken token, Account account );
}