/** * sets the wrapped {@link GeoServerUserGroupService} objects and prepares the {@link * GeoServerUserPasswordEncoder} * * @param service * @throws IOException */ public void setGeoserverUserGroupService(GeoServerUserGroupService service) throws IOException { this.service = service; encoder = new GeoServerMultiplexingPasswordEncoder(service.getSecurityManager(), service); }
public HttpDigestUserDetailsServiceWrapper(GeoServerUserGroupService service, Charset charSet) { this.service = service; this.charSet = charSet; manager = service.getSecurityManager(); enc = new GeoServerMultiplexingPasswordEncoder(service.getSecurityManager(), service); try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("No MD5 algorithm available!"); } }
protected GeoServerMultiplexingPasswordEncoder getEncoder(GeoServerUserGroupService ugService) throws IOException { return new GeoServerMultiplexingPasswordEncoder(getSecurityManager(), ugService); }
@Override public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException { UsernamePasswordAuthenticationProviderConfig upAuthConfig = (UsernamePasswordAuthenticationProviderConfig) config; GeoServerUserGroupService ugService = getSecurityManager().loadUserGroupService(upAuthConfig.getUserGroupServiceName()); if (ugService == null) { throw new IllegalArgumentException( "Unable to load user group service " + upAuthConfig.getUserGroupServiceName()); } userGroupServiceName = upAuthConfig.getUserGroupServiceName(); // create delegate auth provider authProvider = new DaoAuthenticationProvider(); authProvider.setUserDetailsService(ugService); // set up the password encoder // multiplex password encoder actually allows us to handle all types of passwords for // decoding purposes, regardless of whatever the current one used by the user group service // is authProvider.setPasswordEncoder( new GeoServerMultiplexingPasswordEncoder(getSecurityManager(), ugService)); try { authProvider.afterPropertiesSet(); } catch (Exception e) { throw new IOException(e); } }
new GeoServerMultiplexingPasswordEncoder(store.getSecurityManager(), service);
new GeoServerMultiplexingPasswordEncoder(store.getSecurityManager(), store); for (GeoServerUser user : store.getUsers()) { if (encoder.isResponsibleForEncoding(user.getPassword())) continue; // nothing to do
@Test public void testEncode() { GeoServerMultiplexingPasswordEncoder pwe = new GeoServerMultiplexingPasswordEncoder(getSecurityManager()); try { pwe.encodePassword("foo", null); } catch (Exception e) { fail("Multiplexing encoder should be capabile of encoding"); } } }
new GeoServerMultiplexingPasswordEncoder(getSecurityManager()); assertFalse(encoder2.isPasswordValid(encodedPassword, "blabla", null)); assertFalse(encoder2.isPasswordValid(encodedPassword, "blabla".toCharArray(), null));
new GeoServerMultiplexingPasswordEncoder(getSecurityManager(), service);
new GeoServerMultiplexingPasswordEncoder(getSecurityManager());
GeoServerPasswordEncoder encoder = getPlainTextPasswordEncoder(); GeoServerMultiplexingPasswordEncoder encoder2 = new GeoServerMultiplexingPasswordEncoder(getSecurityManager());
GeoServerPasswordEncoder encoder = getDigestPasswordEncoder(); GeoServerMultiplexingPasswordEncoder encoder2 = new GeoServerMultiplexingPasswordEncoder(getSecurityManager());