| | |
| | | import com.gitblit.Constants; |
| | | import com.gitblit.Constants.AccountType; |
| | | import com.gitblit.Constants.AuthenticationType; |
| | | import com.gitblit.Constants.Role; |
| | | import com.gitblit.IStoredSettings; |
| | | import com.gitblit.Keys; |
| | | import com.gitblit.auth.AuthenticationProvider; |
| | |
| | | import com.gitblit.utils.HttpUtils; |
| | | import com.gitblit.utils.StringUtils; |
| | | import com.gitblit.utils.X509Utils.X509Metadata; |
| | | 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 (team != null && team.isLocalTeam()) || findProvider(team).supportsTeamMembershipChanges(); |
| | | } |
| | | |
| | | /** |
| | | * Returns true if the user's role can be changed. |
| | | * |
| | | * @param user |
| | | * @return true if the user's role can be changed |
| | | */ |
| | | @Override |
| | | public boolean supportsRoleChanges(UserModel user, Role role) { |
| | | return (user != null && user.isLocalAccount()) || findProvider(user).supportsRoleChanges(user, role); |
| | | } |
| | | |
| | | /** |
| | | * Returns true if the team's role can be changed. |
| | | * |
| | | * @param user |
| | | * @return true if the team's role can be changed |
| | | */ |
| | | @Override |
| | | public boolean supportsRoleChanges(TeamModel team, Role role) { |
| | | return (team != null && team.isLocalTeam()) || findProvider(team).supportsRoleChanges(team, role); |
| | | } |
| | | |
| | | protected AuthenticationProvider findProvider(UserModel user) { |
| | | for (AuthenticationProvider provider : authenticationProviders) { |
| | | if (provider.getAccountType().equals(user.accountType)) { |