1 package org.apache.archiva.redback.authentication;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.redback.authentication.AuthenticationDataSource;
23 import org.apache.commons.lang.StringUtils;
24 import org.springframework.context.annotation.Scope;
25 import org.springframework.stereotype.Service;
28 * PasswordBasedAuthenticationDataSource: the username is considered the principal with this data source
30 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
34 @Service("authenticationDataSource#password")
36 public class PasswordBasedAuthenticationDataSource
37 implements AuthenticationDataSource
39 private String password;
41 private String principal;
43 public PasswordBasedAuthenticationDataSource()
48 public PasswordBasedAuthenticationDataSource( String principal, String password )
50 this.principal = principal;
51 this.password = password;
54 public String getPassword()
59 public String getPrincipal()
64 public void setPassword( String password )
66 this.password = password;
69 public void setPrincipal( String principal )
71 this.principal = principal;
74 public String toString()
76 StringBuilder sb = new StringBuilder();
77 sb.append( "PasswordBasedAuthenticationDataSource[" );
78 sb.append( "principal=" ).append( principal );
79 sb.append( ",password=" );
80 if ( StringUtils.isNotEmpty( password ) )
82 // Intentionally not showing real password
89 public boolean isEnforcePasswordChange()