Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove ldap settings check from authenticators #2820

Merged
merged 1 commit into from Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -37,15 +37,12 @@ public class AccessTokenAuthenticator extends AuthenticatingRealm {

private final AccessTokenService accessTokenService;
private final UserService userService;
private final LdapUserAuthenticator ldapAuthenticator;

@Inject
AccessTokenAuthenticator(AccessTokenService accessTokenService,
UserService userService,
LdapUserAuthenticator ldapAuthenticator) {
UserService userService) {
this.accessTokenService = accessTokenService;
this.userService = userService;
this.ldapAuthenticator = ldapAuthenticator;
setAuthenticationTokenClass(AccessTokenAuthToken.class);
setCachingEnabled(false);
// the presence of a valid access token is enough, we don't have any other credentials
Expand All @@ -64,9 +61,6 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
if (user == null) {
return null;
}
if (user.isExternalUser() && !ldapAuthenticator.isEnabled()) {
throw new LockedAccountException("LDAP authentication is currently disabled.");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Found user {} for access token.", user);
}
Expand Down
Expand Up @@ -19,7 +19,6 @@
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.SimpleAccount;
import org.apache.shiro.authc.credential.AllowAllCredentialsMatcher;
import org.apache.shiro.realm.AuthenticatingRealm;
Expand All @@ -42,12 +41,10 @@ public class SessionAuthenticator extends AuthenticatingRealm {
public static final String X_GRAYLOG_NO_SESSION_EXTENSION = "X-Graylog-No-Session-Extension";

private final UserService userService;
private final LdapUserAuthenticator ldapAuthenticator;

@Inject
SessionAuthenticator(UserService userService, LdapUserAuthenticator ldapAuthenticator) {
SessionAuthenticator(UserService userService) {
this.userService = userService;
this.ldapAuthenticator = ldapAuthenticator;
// this realm either rejects a session, or allows the associated user implicitly
setCredentialsMatcher(new AllowAllCredentialsMatcher());
setAuthenticationTokenClass(SessionIdToken.class);
Expand All @@ -70,9 +67,6 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
LOG.debug("No user named {} found for session {}", username, sessionIdToken.getSessionId());
return null;
}
if (user.isExternalUser() && !ldapAuthenticator.isEnabled()) {
throw new LockedAccountException("LDAP authentication is currently disabled.");
}

if (LOG.isDebugEnabled()) {
LOG.debug("Found session {} for user name {}", session.getId(), username);
Expand Down