| | |
| | | |
| | | protected final Logger log = LoggerFactory.getLogger(getClass()); |
| | | protected final IAuthenticationManager authManager; |
| | | protected final boolean stripDomain; |
| | | |
| | | public SshKrbAuthenticator(IAuthenticationManager authManager) { |
| | | public SshKrbAuthenticator(IAuthenticationManager authManager, boolean stripDomain) { |
| | | this.authManager = authManager; |
| | | this.stripDomain = stripDomain; |
| | | log.info("registry {}", authManager); |
| | | } |
| | | |
| | |
| | | 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); |