@@ -205,12 +205,6 @@ public String getLDAPURL() {
205205 */
206206 public transient GrantedAuthority [] authorities = new GrantedAuthority [0 ];
207207
208- public void setAuthorities (GrantedAuthority [] authorities ) {
209- this .authorities = new GrantedAuthority [0 ];
210- this .authorities = authorities ;
211- }
212-
213-
214208 @ DataBoundConstructor
215209 public LdapAuthorizationType (String server , String rootDN , boolean inhibitInferRootDN ,
216210 String userSearchBase , String userSearch , String groupSearchBase , String groupSearchFilter , String groupMembershipFilter , String groupNameAttribute , String managerDN , String managerPassword ,
@@ -331,22 +325,22 @@ public GrantedAuthority[] retrieveAuthorities(String userFromHeader, HttpServlet
331325 GrantedAuthority [] storedGrants = authContext .get (userFromHeader );
332326
333327 if (storedGrants != null && storedGrants .length > 1 ) {
334- setAuthorities ( retrieveAuthoritiesIfNecessary (authorityUpdateCache , updateInterval , userFromHeader , storedGrants ) );
328+ authorities = retrieveAuthoritiesIfNecessary (authorityUpdateCache , updateInterval , userFromHeader , storedGrants );
335329 } else {
336330 try {
337331 LdapUserDetails userDetails = (LdapUserDetails ) getSecurityRealm ().loadUserByUsername (userFromHeader );
338332 authorities = userDetails .getAuthorities ();
339333
340334 Set <GrantedAuthority > tempLocalAuthorities = new HashSet <GrantedAuthority >(Arrays .asList (authorities ));
341335 tempLocalAuthorities .add (AUTHENTICATED_AUTHORITY );
342- setAuthorities ( tempLocalAuthorities .toArray (new GrantedAuthority [0 ]) );
336+ authorities = tempLocalAuthorities .toArray (new GrantedAuthority [0 ]);
343337
344338 } catch (UsernameNotFoundException e ) {
345339 LOGGER .log (Level .WARNING , "User not found in the LDAP directory: " + e .getMessage ());
346340
347341 Set <GrantedAuthority > tempLocalAuthorities = new HashSet <GrantedAuthority >();
348342 tempLocalAuthorities .add (AUTHENTICATED_AUTHORITY );
349- setAuthorities ( tempLocalAuthorities .toArray (new GrantedAuthority [0 ]) );
343+ authorities = tempLocalAuthorities .toArray (new GrantedAuthority [0 ]);
350344 }
351345 }
352346 authContext .put (userFromHeader , authorities );
0 commit comments