| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <title>Source code</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| </head> |
| <body> |
| <main role="main"> |
| <div class="sourceContainer"> |
| <pre><span class="sourceLineNo">001</span><a id="line.1">/*</a> |
| <span class="sourceLineNo">002</span><a id="line.2"> * Licensed to the Apache Software Foundation (ASF) under one</a> |
| <span class="sourceLineNo">003</span><a id="line.3"> * or more contributor license agreements. See the NOTICE file</a> |
| <span class="sourceLineNo">004</span><a id="line.4"> * distributed with this work for additional information</a> |
| <span class="sourceLineNo">005</span><a id="line.5"> * regarding copyright ownership. The ASF licenses this file</a> |
| <span class="sourceLineNo">006</span><a id="line.6"> * to you under the Apache License, Version 2.0 (the</a> |
| <span class="sourceLineNo">007</span><a id="line.7"> * "License"); you may not use this file except in compliance</a> |
| <span class="sourceLineNo">008</span><a id="line.8"> * with the License. You may obtain a copy of the License at</a> |
| <span class="sourceLineNo">009</span><a id="line.9"> *</a> |
| <span class="sourceLineNo">010</span><a id="line.10"> * http://www.apache.org/licenses/LICENSE-2.0</a> |
| <span class="sourceLineNo">011</span><a id="line.11"> *</a> |
| <span class="sourceLineNo">012</span><a id="line.12"> * Unless required by applicable law or agreed to in writing,</a> |
| <span class="sourceLineNo">013</span><a id="line.13"> * software distributed under the License is distributed on an</a> |
| <span class="sourceLineNo">014</span><a id="line.14"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</a> |
| <span class="sourceLineNo">015</span><a id="line.15"> * KIND, either express or implied. See the License for the</a> |
| <span class="sourceLineNo">016</span><a id="line.16"> * specific language governing permissions and limitations</a> |
| <span class="sourceLineNo">017</span><a id="line.17"> * under the License.</a> |
| <span class="sourceLineNo">018</span><a id="line.18"> */</a> |
| <span class="sourceLineNo">019</span><a id="line.19">package org.apache.shiro.authc;</a> |
| <span class="sourceLineNo">020</span><a id="line.20"></a> |
| <span class="sourceLineNo">021</span><a id="line.21">import java.io.Serializable;</a> |
| <span class="sourceLineNo">022</span><a id="line.22"></a> |
| <span class="sourceLineNo">023</span><a id="line.23">/**</a> |
| <span class="sourceLineNo">024</span><a id="line.24"> * <p>An <tt>AuthenticationToken</tt> is a consolidation of an account's principals and supporting</a> |
| <span class="sourceLineNo">025</span><a id="line.25"> * credentials submitted by a user during an authentication attempt.</a> |
| <span class="sourceLineNo">026</span><a id="line.26"> * <p/></a> |
| <span class="sourceLineNo">027</span><a id="line.27"> * <p>The token is submitted to an {@link Authenticator Authenticator} via the</a> |
| <span class="sourceLineNo">028</span><a id="line.28"> * {@link Authenticator#authenticate(AuthenticationToken) authenticate(token)} method. The</a> |
| <span class="sourceLineNo">029</span><a id="line.29"> * Authenticator then executes the authentication/log-in process.</a> |
| <span class="sourceLineNo">030</span><a id="line.30"> * <p/></a> |
| <span class="sourceLineNo">031</span><a id="line.31"> * <p>Common implementations of an <tt>AuthenticationToken</tt> would have username/password</a> |
| <span class="sourceLineNo">032</span><a id="line.32"> * pairs, X.509 Certificate, PGP key, or anything else you can think of. The token can be</a> |
| <span class="sourceLineNo">033</span><a id="line.33"> * anything needed by an {@link Authenticator} to authenticate properly.</a> |
| <span class="sourceLineNo">034</span><a id="line.34"> * <p/></a> |
| <span class="sourceLineNo">035</span><a id="line.35"> * <p>Because applications represent user data and credentials in different ways, implementations</a> |
| <span class="sourceLineNo">036</span><a id="line.36"> * of this interface are application-specific. You are free to acquire a user's principals and</a> |
| <span class="sourceLineNo">037</span><a id="line.37"> * credentials however you wish (e.g. web form, Swing form, fingerprint identification, etc) and</a> |
| <span class="sourceLineNo">038</span><a id="line.38"> * then submit them to the Shiro framework in the form of an implementation of this</a> |
| <span class="sourceLineNo">039</span><a id="line.39"> * interface.</a> |
| <span class="sourceLineNo">040</span><a id="line.40"> * <p/></a> |
| <span class="sourceLineNo">041</span><a id="line.41"> * <p>If your application's authentication process is username/password based</a> |
| <span class="sourceLineNo">042</span><a id="line.42"> * (like most), instead of implementing this interface yourself, take a look at the</a> |
| <span class="sourceLineNo">043</span><a id="line.43"> * {@link UsernamePasswordToken UsernamePasswordToken} class, as it is probably sufficient for your needs.</a> |
| <span class="sourceLineNo">044</span><a id="line.44"> * <p/></a> |
| <span class="sourceLineNo">045</span><a id="line.45"> * <p>RememberMe services are enabled for a token if they implement a sub-interface of this one, called</a> |
| <span class="sourceLineNo">046</span><a id="line.46"> * {@link RememberMeAuthenticationToken RememberMeAuthenticationToken}. Implement that interface if you need</a> |
| <span class="sourceLineNo">047</span><a id="line.47"> * RememberMe services (the <tt>UsernamePasswordToken</tt> already implements this interface).</a> |
| <span class="sourceLineNo">048</span><a id="line.48"> * <p/></a> |
| <span class="sourceLineNo">049</span><a id="line.49"> * <p>If you are familiar with JAAS, an <tt>AuthenticationToken</tt> replaces the concept of a</a> |
| <span class="sourceLineNo">050</span><a id="line.50"> * {@link javax.security.auth.callback.Callback}, and defines meaningful behavior</a> |
| <span class="sourceLineNo">051</span><a id="line.51"> * (<tt>Callback</tt> is just a marker interface, and of little use). We</a> |
| <span class="sourceLineNo">052</span><a id="line.52"> * also think the name <em>AuthenticationToken</em> more accurately reflects its true purpose</a> |
| <span class="sourceLineNo">053</span><a id="line.53"> * in a login framework, whereas <em>Callback</em> is less obvious.</a> |
| <span class="sourceLineNo">054</span><a id="line.54"> *</a> |
| <span class="sourceLineNo">055</span><a id="line.55"> * @see RememberMeAuthenticationToken</a> |
| <span class="sourceLineNo">056</span><a id="line.56"> * @see HostAuthenticationToken</a> |
| <span class="sourceLineNo">057</span><a id="line.57"> * @see UsernamePasswordToken</a> |
| <span class="sourceLineNo">058</span><a id="line.58"> * @since 0.1</a> |
| <span class="sourceLineNo">059</span><a id="line.59"> */</a> |
| <span class="sourceLineNo">060</span><a id="line.60">public interface AuthenticationToken extends Serializable {</a> |
| <span class="sourceLineNo">061</span><a id="line.61"></a> |
| <span class="sourceLineNo">062</span><a id="line.62"> /**</a> |
| <span class="sourceLineNo">063</span><a id="line.63"> * Returns the account identity submitted during the authentication process.</a> |
| <span class="sourceLineNo">064</span><a id="line.64"> * <p/></a> |
| <span class="sourceLineNo">065</span><a id="line.65"> * <p>Most application authentications are username/password based and have this</a> |
| <span class="sourceLineNo">066</span><a id="line.66"> * object represent a username. If this is the case for your application,</a> |
| <span class="sourceLineNo">067</span><a id="line.67"> * take a look at the {@link UsernamePasswordToken UsernamePasswordToken}, as it is probably</a> |
| <span class="sourceLineNo">068</span><a id="line.68"> * sufficient for your use.</a> |
| <span class="sourceLineNo">069</span><a id="line.69"> * <p/></a> |
| <span class="sourceLineNo">070</span><a id="line.70"> * <p>Ultimately, the object returned is application specific and can represent</a> |
| <span class="sourceLineNo">071</span><a id="line.71"> * any account identity (user id, X.509 certificate, etc).</a> |
| <span class="sourceLineNo">072</span><a id="line.72"> *</a> |
| <span class="sourceLineNo">073</span><a id="line.73"> * @return the account identity submitted during the authentication process.</a> |
| <span class="sourceLineNo">074</span><a id="line.74"> * @see UsernamePasswordToken</a> |
| <span class="sourceLineNo">075</span><a id="line.75"> */</a> |
| <span class="sourceLineNo">076</span><a id="line.76"> Object getPrincipal();</a> |
| <span class="sourceLineNo">077</span><a id="line.77"></a> |
| <span class="sourceLineNo">078</span><a id="line.78"> /**</a> |
| <span class="sourceLineNo">079</span><a id="line.79"> * Returns the credentials submitted by the user during the authentication process that verifies</a> |
| <span class="sourceLineNo">080</span><a id="line.80"> * the submitted {@link #getPrincipal() account identity}.</a> |
| <span class="sourceLineNo">081</span><a id="line.81"> * <p/></a> |
| <span class="sourceLineNo">082</span><a id="line.82"> * <p>Most application authentications are username/password based and have this object</a> |
| <span class="sourceLineNo">083</span><a id="line.83"> * represent a submitted password. If this is the case for your application,</a> |
| <span class="sourceLineNo">084</span><a id="line.84"> * take a look at the {@link UsernamePasswordToken UsernamePasswordToken}, as it is probably</a> |
| <span class="sourceLineNo">085</span><a id="line.85"> * sufficient for your use.</a> |
| <span class="sourceLineNo">086</span><a id="line.86"> * <p/></a> |
| <span class="sourceLineNo">087</span><a id="line.87"> * <p>Ultimately, the credentials Object returned is application specific and can represent</a> |
| <span class="sourceLineNo">088</span><a id="line.88"> * any credential mechanism.</a> |
| <span class="sourceLineNo">089</span><a id="line.89"> *</a> |
| <span class="sourceLineNo">090</span><a id="line.90"> * @return the credential submitted by the user during the authentication process.</a> |
| <span class="sourceLineNo">091</span><a id="line.91"> */</a> |
| <span class="sourceLineNo">092</span><a id="line.92"> Object getCredentials();</a> |
| <span class="sourceLineNo">093</span><a id="line.93"></a> |
| <span class="sourceLineNo">094</span><a id="line.94">}</a> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| </pre> |
| </div> |
| </main> |
| </body> |
| </html> |