1 package org.codehaus.plexus.redback.authentication;
3 import org.springframework.context.annotation.Scope;
4 import org.springframework.stereotype.Service;
7 * Copyright 2001-2006 The Codehaus.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * TokenBasedAuthenticationDataSource
25 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
29 @Service("authenticationDataSource#token")
31 public class TokenBasedAuthenticationDataSource
32 implements AuthenticationDataSource
36 private String principal;
38 private boolean enforcePasswordChange = true;
40 public TokenBasedAuthenticationDataSource( String principal )
42 this.principal = principal;
45 public TokenBasedAuthenticationDataSource()
49 public String getPrincipal()
54 public String getToken()
59 public void setPrincipal( String principal )
61 this.principal = principal;
64 public void setToken( String token )
69 public String toString()
71 StringBuffer sb = new StringBuffer();
72 sb.append( "TokenBasedAuthenticationDataSource[" );
73 sb.append( "principal=" ).append( principal );
74 sb.append( ",token=" ).append( token );
79 public void setEnforcePasswordChange( boolean enforcePasswordChange )
81 this.enforcePasswordChange = enforcePasswordChange;
84 public boolean isEnforcePasswordChange()
86 return enforcePasswordChange;