| | |
| | | |
| | | protected final Logger log = LoggerFactory.getLogger(getClass()); |
| | | protected final IAuthenticationManager authManager; |
| | | protected final boolean stripDomain; |
| | | |
| | | |
| | | public SshKrbAuthenticator(IStoredSettings settings, IAuthenticationManager authManager) { |
| | | this.authManager = authManager; |
| | |
| | | if(! servicePrincipalName.isEmpty()) { |
| | | setServicePrincipalName(servicePrincipalName); |
| | | } |
| | | |
| | | this.stripDomain = settings.getBoolean(Keys.git.sshKrb5StripDomain, false); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return true; |
| | | } |
| | | String username = identity.toLowerCase(Locale.US); |
| | | if (stripDomain) { |
| | | int p = username.indexOf('@'); |
| | | if (p > 0) { |
| | | username = username.substring(0, p); |
| | | } |
| | | } |
| | | UserModel user = authManager.authenticate(username); |
| | | if (user != null) { |
| | | client.setUser(user); |