/** Looks up all available password encoders. */ public List<GeoServerPasswordEncoder> loadPasswordEncoders() { return loadPasswordEncoders(null); }
/** * Looks up all available password encoders filtering out only those that are instances of the * specified class. * * <p>This method is convenience for: * * <pre> * loadPasswordEncoders(filter, null, null) * </pre> */ public <T extends GeoServerPasswordEncoder> List<T> loadPasswordEncoders(Class<T> filter) { return loadPasswordEncoders(filter, null, null); }
/** * Loads the first password encoder that matches the specified criteria. * * @param filter Class used to filter password encoders. * @param reversible Flag indicating if a reversible encoder is required, true forces * reversible, false forces irreversible, null means either. * @param strong Flag indicating if an encoder that supports strong encryption is required, true * forces strong encryption, false forces weak encryption, null means either. * @return The first encoder matching, or null if none was found. */ public <T extends GeoServerPasswordEncoder> T loadPasswordEncoder( Class<T> filter, Boolean reversible, Boolean strong) { List<T> pw = loadPasswordEncoders(filter, reversible, strong); return pw.isEmpty() ? null : pw.get(0); }
/** Decrypts a previously encrypted value. */ public String decode(String value) { return decode(value, securityManager.loadPasswordEncoders(null, true, null)); }
/** Decrypts previously encrypted store connection parameters. */ public void decode(StoreInfo info) { List<GeoServerPasswordEncoder> encoders = securityManager.loadPasswordEncoders(null, true, null); Set<String> encryptedFields = getEncryptedFields(info); if (info.getConnectionParameters() != null) { for (String key : info.getConnectionParameters().keySet()) { if (encryptedFields.contains(key)) { String value = (String) info.getConnectionParameters().get(key); if (value != null) { info.getConnectionParameters().put(key, decode(value, encoders)); } } } } }
public GeoServerMultiplexingPasswordEncoder( GeoServerSecurityManager secMgr, GeoServerUserGroupService service) { encoders = new HashSet<GeoServerPasswordEncoder>(); for (GeoServerPasswordEncoder enc : secMgr.loadPasswordEncoders()) { if (StringUtils.hasLength(enc.getPrefix())) { if (service != null) { try { if (enc instanceof GeoServerPBEPasswordEncoder) { if (!secMgr.getKeyStoreProvider().hasUserGroupKey(service.getName())) { continue; // cannot use pbe encoder, no key } } enc.initializeFor(service); } catch (IOException e) { throw new RuntimeException(e); } } encoders.add(enc); } } }
expect(secMgr.loadPasswordEncoders()) .andAnswer( new IAnswer<List<GeoServerPasswordEncoder>>() {
PasswordEncoderNamesModel() { this(GeoServerApplication.get().getSecurityManager().loadPasswordEncoders()); }
PasswordEncoderNamesModel() { this(GeoServerApplication.get().getSecurityManager().loadPasswordEncoders()); }
PasswordEncoderNamesModel() { this(GeoServerApplication.get().getSecurityManager().loadPasswordEncoders()); }
public EncryptionPanel(String id) { super(id, new Model()); GeoServerSecurityManager secMgr = getSecurityManager(); if (secMgr.isStrongEncryptionAvailable()) { add(new Label("strongEncryptionMsg", new StringResourceModel("strongEncryption", this, null)) .add(new AttributeAppender("class", new Model("info-link"), " "))); } else { add(new Label("strongEncryptionMsg", new StringResourceModel("noStrongEncryption", this, null)) .add(new AttributeAppender("class", new Model("warning-link"), " "))); } add(new CheckBox("encryptingUrlParams")); //load only reversible encoders add(new PasswordEncoderChoice("configPasswordEncrypterName", getSecurityManager().loadPasswordEncoders(null, true, null))); } }
public EncryptionPanel(String id) { super(id, new Model()); GeoServerSecurityManager secMgr = getSecurityManager(); if (secMgr.isStrongEncryptionAvailable()) { add(new Label("strongEncryptionMsg", new StringResourceModel("strongEncryption", this, null)) .add(new AttributeAppender("class", new Model("info-link"), " "))); } else { add(new Label("strongEncryptionMsg", new StringResourceModel("noStrongEncryption", this, null)) .add(new AttributeAppender("class", new Model("warning-link"), " "))); } add(new CheckBox("encryptingUrlParams")); //load only reversible encoders add(new PasswordEncoderChoice("configPasswordEncrypterName", getSecurityManager().loadPasswordEncoders(null, true, null))); } }
public EncryptionPanel(String id) { super(id, new Model()); GeoServerSecurityManager secMgr = getSecurityManager(); if (secMgr.isStrongEncryptionAvailable()) { add( new Label( "strongEncryptionMsg", new StringResourceModel("strongEncryption", this, null)) .add(new AttributeAppender("class", new Model("info-link"), " "))); } else { add( new Label( "strongEncryptionMsg", new StringResourceModel("noStrongEncryption", this, null)) .add( new AttributeAppender( "class", new Model("warning-link"), " "))); } add(new CheckBox("encryptingUrlParams")); // load only reversible encoders add( new PasswordEncoderChoice( "configPasswordEncrypterName", getSecurityManager().loadPasswordEncoders(null, true, null))); } }