public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws UnsupportedOperationException { GeoServerPasswordEncoder enc = lookupEncoderForEncodedPassword(encPass); return enc.isPasswordValid(encPass, rawPass, salt); }
@Override public boolean isPasswordValid(String encPass, char[] rawPass, Object salt) { if (encPass == null) return false; return getCharEncoder().isPasswordValid(stripPrefix(encPass), rawPass, salt); }
public String decode(String encPass) throws UnsupportedOperationException { GeoServerPasswordEncoder enc = lookupEncoderForEncodedPassword(encPass); return enc.decode(encPass); }
String decode(String value, List<GeoServerPasswordEncoder> encoders) { for (GeoServerPasswordEncoder encoder : encoders) { if (encoder.isReversible() == false) continue; // should not happen if (encoder.isResponsibleForEncoding(value)) { return encoder.decode(value); } } return value; } }
protected GeoServerPBEPasswordEncoder createStrongPbePasswordEncoder( GeoServerSecurityManager secMgr) throws IOException { GeoServerPBEPasswordEncoder strongPbePwe = new GeoServerPBEPasswordEncoder(); strongPbePwe.setBeanName("strongPbePasswordEncoder"); strongPbePwe.setPrefix("crypt2"); strongPbePwe.setProviderName("BC"); strongPbePwe.setAvailableWithoutStrongCryptogaphy(false); strongPbePwe.initialize(secMgr); return strongPbePwe; }
public MasterPasswordProviderConfig(MasterPasswordProviderConfig other) { super(other); this.readOnly = other.isReadOnly(); this.loginEnabled = other.loginEnabled; }
@Override protected void doSetMasterPassword(char[] passwd) throws Exception { OutputStream out = output(config.getURL(), getConfigDir()); try { out.write(encode(passwd)); } finally { out.close(); } }
protected GeoServerPBEPasswordEncoder createPbePasswordEncoder(GeoServerSecurityManager secMgr) throws IOException { GeoServerPBEPasswordEncoder pbePwe = new GeoServerPBEPasswordEncoder(); pbePwe.setBeanName("pbePasswordEncoder"); pbePwe.setPrefix("crypt1"); pbePwe.setAlgorithm("PBEWITHMD5ANDDES"); pbePwe.initialize(secMgr); return pbePwe; }
@Override public String encode(CharSequence rawPassword) { return createCharEncoder().encodePassword(decodeToCharArray(rawPassword.toString()), null); } }
public char[] decodeToCharArray(String encPass) throws UnsupportedOperationException { GeoServerPasswordEncoder enc = lookupEncoderForEncodedPassword(encPass); return enc.decodeToCharArray(encPass); }
@Override public String encodePassword(char[] rawPass, Object salt) throws DataAccessException { return doEncodePassword(getCharEncoder().encodePassword(rawPass, salt)); }
protected GeoServerDigestPasswordEncoder createDigestPasswordEncoder( GeoServerSecurityManager secMgr) throws IOException { GeoServerDigestPasswordEncoder digestPwe = new GeoServerDigestPasswordEncoder(); digestPwe.setBeanName("digestPasswordEncoder"); digestPwe.setPrefix("digest1"); return digestPwe; }
protected GeoServerEmptyPasswordEncoder createEmptyPasswordEncoder( GeoServerSecurityManager secMgr) throws IOException { GeoServerEmptyPasswordEncoder emptyPwe = new GeoServerEmptyPasswordEncoder(); emptyPwe.setBeanName("emptyPasswordEncoder"); emptyPwe.setPrefix("empty"); return emptyPwe; }
/** * Scrambles a char array overwriting all characters with random characters, used for scrambling * plain text passwords after usage to avoid keeping them around in memory. */ public static void scramble(char[] ch) { if (ch == null) return; RandomPasswordProvider rpp = new RandomPasswordProvider(); rpp.getRandomPassword(ch); }
/** * Creates a new Instance * * @param service * @throws IOException */ public static DecodingUserDetailsService newInstance(GeoServerUserGroupService service) throws IOException { DecodingUserDetailsService decodingService = new DecodingUserDetailsService(); decodingService.setGeoserverUserGroupService(service); return decodingService; }
@Override public MasterPasswordProvider createMasterPasswordProvider( MasterPasswordProviderConfig config) throws IOException { return new URLMasterPasswordProvider(); }
/** * Creates a random password of the specified length, if length <=0, return <code>null</code> */ public char[] getRandomPassword(int length) { if (length <= 0) return null; char[] buff = new char[length]; getRandomPassword(buff); return buff; }
protected CharArrayPasswordEncoder getCharEncoder() { if (charEncoder == null) { synchronized (this) { if (charEncoder == null) { charEncoder = createCharEncoder(); } } } return charEncoder; }
public boolean isPasswordValid(String encPass, char[] rawPass, Object salt) throws UnsupportedOperationException { GeoServerPasswordEncoder enc = lookupEncoderForEncodedPassword(encPass); return enc.isPasswordValid(encPass, rawPass, salt); }
/** * Scrambles a byte array overwriting all characters with random characters, used for scrambling * plain text passwords after usage to avoid keeping them around in memory. */ public static void scramble(byte[] ch) { if (ch == null) return; RandomPasswordProvider rpp = new RandomPasswordProvider(); rpp.getRandomPassword(ch); } /** Builds the write query based on the access limits class */