From 43b087048b3ea41d99ca6282485f3c0ecb683008 Mon Sep 17 00:00:00 2001 From: Prabhjyot Singh Date: Tue, 14 Jun 2016 14:01:12 +0530 Subject: [PATCH] activeDirectoryRealm.principalSuffix isn't honoured --- .../shiro/realm/activedirectory/ActiveDirectoryRealm.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java index 6926a9962c..73d807f7d5 100644 --- a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java +++ b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java @@ -105,7 +105,12 @@ protected AuthenticationInfo queryForAuthenticationInfo(AuthenticationToken toke // Binds using the username and password provided by the user. LdapContext ctx = null; try { - ctx = ldapContextFactory.getLdapContext(upToken.getUsername(), String.valueOf(upToken.getPassword())); + String userPrincipalName = upToken.getUsername(); + if (this.principalSuffix != null) { + userPrincipalName = upToken.getUsername() + this.principalSuffix; + } + ctx = ldapContextFactory.getLdapContext( + userPrincipalName, upToken.getPassword()); } finally { LdapUtils.closeContext(ctx); }