| | |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.security.Principal; |
| | | import java.security.PublicKey; |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | import com.gitblit.auth.WindowsAuthProvider; |
| | | import com.gitblit.models.TeamModel; |
| | | import com.gitblit.models.UserModel; |
| | | import com.gitblit.transport.ssh.SshKey; |
| | | import com.gitblit.utils.Base64; |
| | | import com.gitblit.utils.HttpUtils; |
| | | import com.gitblit.utils.StringUtils; |
| | | import com.gitblit.utils.X509Utils.X509Metadata; |
| | | import com.gitblit.wicket.GitBlitWebSession; |
| | | import com.google.inject.Inject; |
| | | import com.google.inject.Singleton; |
| | | |
| | | /** |
| | | * The authentication manager handles user login & logout. |
| | |
| | | * @author James Moger |
| | | * |
| | | */ |
| | | @Singleton |
| | | public class AuthenticationManager implements IAuthenticationManager { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(getClass()); |
| | |
| | | |
| | | private final Map<String, String> legacyRedirects; |
| | | |
| | | @Inject |
| | | public AuthenticationManager( |
| | | IRuntimeManager runtimeManager, |
| | | IUserManager userManager) { |
| | |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | |
| | | public void addAuthenticationProvider(AuthenticationProvider prov) { |
| | | authenticationProviders.add(prov); |
| | | } |
| | |
| | | * @return a user object or null |
| | | */ |
| | | @Override |
| | | public UserModel authenticate(String username, PublicKey key) { |
| | | public UserModel authenticate(String username, SshKey key) { |
| | | if (username != null) { |
| | | if (!StringUtils.isEmpty(username)) { |
| | | UserModel user = userManager.getUserModel(username); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // could not authenticate locally or with a provider |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns a UserModel if local authentication succeeds. |
| | | * |
| | | * |
| | | * @param user |
| | | * @param password |
| | | * @return a UserModel if local authentication succeeds, null otherwise |