//Will do GSS ?
GSSAuthenticator gssAuthenticator = null;
if(settings.getBoolean(Keys.git.sshWithKrb5, false)) {
- gssAuthenticator = new SshKrbAuthenticator(gitblit);
+ gssAuthenticator = new SshKrbAuthenticator(gitblit, settings.getBoolean(Keys.git.sshKrb5StripDomain, false));
String keytabString = settings.getString(Keys.git.sshKrb5Keytab,
"");
if(! keytabString.isEmpty()) {
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;
- log.info("registry {}", authManager);
+ this.stripDomain = stripDomain;
+ log.info("registry {}", authManager);
}
public boolean validateIdentity(ServerSession session, String identity) {
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);