public void bind( final String password, final PasswordKey pwid ) { if ( password == null ) { return; } SiteConfig config = getConfig( pwid.getSiteId() ); if ( config != null ) { set( config, pwid.getPasswordType(), password ); } }
@Override public void unbind( PasswordKey id ) { SiteConfig config = getConfig( id.getSiteId() ); if ( config != null ) { clear( config, id.getPasswordType() ); } }
@Override public void unbind( SiteConfig config, PasswordType type ) { clear( config, type ); }
@Override public String lookup( final PasswordKey id ) { SiteConfig config = lookupManager.lookup( id.getSiteId() ); if ( config == null ) { return null; } return config.getAttribute( PASSWORD_PREFIX + id.getPasswordType().name(), String.class ); }
@Override public String lookup( PasswordKey id ) { Location location = locationLookup.lookup( id.getSiteId() ); return location == null ? null : delegate.getPassword( new PasswordEntry( location, id.getPasswordType().name() ) ); } }
@Override public void bind( final String password, final String siteId, final PasswordType type ) { passwords.put( new PasswordKey( siteId, type ), password ); }
public void bind( final String password, final SiteConfig loc, final PasswordType type ) { if ( password == null ) { return; } set( loc, type, password ); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( siteId.hashCode() ); result = prime * result + ( ( passwordType == null ) ? 0 : passwordType.hashCode() ); return result; }
private SiteConfig getConfig( String siteId ) { SiteConfig config = lookupManager.lookup( siteId ); if ( config == null ) { Logger logger = LoggerFactory.getLogger( getClass() ); logger.warn( "Site config not found for: {}", siteId ); } return config; }
public HttpFactory( final PasswordManager passwords ) { this.passwords = passwords; this.authenticator = new BasicAuthenticator( passwords ); this.connectionCache = new ConnectionManagerCache(); }
@Inject public CausewayProducer( CausewayConfig config ) { this.config = config; passwords.bind(config.getKojiClientCertificatePassword(), CausewayConfig.KOJI_SITE_ID, PasswordType.KEY); }
@Override public String lookup( PasswordKey id ) { Location location = locationLookup.lookup( id.getSiteId() ); return location == null ? null : delegate.getPassword( new PasswordEntry( location, id.getPasswordType().name() ) ); } }
private void clear( SiteConfig loc, PasswordType type ) { loc.removeAttribute( PASSWORD_PREFIX + type.name() ); }
@Override public void unbind( String siteId, PasswordType type ) { passwords.remove( new PasswordKey( siteId, type ) ); }
private void set( SiteConfig loc, PasswordType type, String password ) { loc.setAttribute( PASSWORD_PREFIX + type.name(), password ); }
@Override public void unbind( SiteConfig config, PasswordType type ) { passwords.remove( new PasswordKey( config.getId(), type ) ); }
@Override public void bind( final String password, final SiteConfig config, final PasswordType type ) { passwords.put( new PasswordKey( config.getId(), type ), password ); }