/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
@VisibleForTesting void setUsingLegacyMethod(String username) throws IOException, InterruptedException { props.setProperty(getPropertyKey(), username + USERNAME_VERIFICATION_SEPARATOR + getMacOf(username)); save(); }
String val = props.getProperty(getPropertyKey()); if (val == null) { LOGGER.finer("No stored CLI authentication");
props.setProperty(getPropertyKey(), propertyValue);
/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey()) != null) { save(); } }
/** * Removes the persisted credential, if there's one. */ public void remove() throws IOException, InterruptedException { if (props.remove(getPropertyKey())!=null) save(); }
String val = props.getProperty(getPropertyKey()); if (val == null) { LOGGER.finer("No stored CLI authentication");
/** * Persists the specified authentication. */ public void set(Authentication a) throws IOException, InterruptedException { Hudson h = Hudson.getInstance(); // make sure that this security realm is capable of retrieving the authentication by name, // as it's not required. UserDetails u = h.getSecurityRealm().loadUserByUsername(a.getName()); props.setProperty(getPropertyKey(), Secret.fromString(u.getUsername()).getEncryptedValue()); save(); }
/** * Persists the specified authentication. */ public void set(Authentication a) throws IOException, InterruptedException { Jenkins h = Jenkins.getActiveInstance(); // make sure that this security realm is capable of retrieving the authentication by name, // as it's not required. UserDetails u = h.getSecurityRealm().loadUserByUsername(a.getName()); String username = u.getUsername(); props.setProperty(getPropertyKey(), username + ":" + MAC.mac(username)); save(); }
/** * Persists the specified authentication. */ public void set(Authentication a) throws IOException, InterruptedException { Hudson h = Hudson.getInstance(); // make sure that this security realm is capable of retrieving the authentication by name, // as it's not required. UserDetails u = h.getSecurityRealm().loadUserByUsername(a.getName()); props.setProperty(getPropertyKey(), Secret.fromString(u.getUsername()).getEncryptedValue()); save(); }
/** * Persists the specified authentication. */ public void set(Authentication a) throws IOException, InterruptedException { Hudson h = Hudson.getInstance(); // make sure that this security realm is capable of retrieving the authentication by name, // as it's not required. UserDetails u = h.getSecurityRealm().loadUserByUsername(a.getName()); props.setProperty(getPropertyKey(), Secret.fromString(u.getUsername()).getEncryptedValue()); save(); }
/** * Gets the persisted authentication for this Hudson. * * @return {@link Hudson#ANONYMOUS} if no such credential is found, or if * the stored credential is invalid. */ public Authentication get() { Secret userName = Secret.decrypt(props.getProperty(getPropertyKey())); if (userName == null) { return Hudson.ANONYMOUS; // failed to decrypt } try { UserDetails u = HudsonSecurityEntitiesHolder.getHudsonSecurityManager().getSecurityRealm().loadUserByUsername(userName.toString()); return new UsernamePasswordAuthenticationToken(u.getUsername(), u.getPassword(), u.getAuthorities()); } catch (AuthenticationException e) { return Hudson.ANONYMOUS; } catch (DataAccessException e) { return Hudson.ANONYMOUS; } }
/** * Persists the specified authentication. */ public void set(Authentication a) throws IOException, InterruptedException { Hudson h = Hudson.getInstance(); // make sure that this security realm is capable of retrieving the authentication by name, // as it's not required. UserDetails u = h.getSecurityRealm().loadUserByUsername(a.getName()); props.setProperty(getPropertyKey(), Secret.fromString(u.getUsername()).getEncryptedValue()); save(); }
/** * Gets the persisted authentication for this Hudson. * * @return {@link Hudson#ANONYMOUS} if no such credential is found, or if the stored credential is invalid. */ public Authentication get() { Hudson h = Hudson.getInstance(); Secret userName = Secret.decrypt(props.getProperty(getPropertyKey())); if (userName==null) return Hudson.ANONYMOUS; // failed to decrypt try { UserDetails u = h.getSecurityRealm().loadUserByUsername(userName.toString()); return new UsernamePasswordAuthenticationToken(u.getUsername(), u.getPassword(), u.getAuthorities()); } catch (AuthenticationException e) { return Hudson.ANONYMOUS; } catch (DataAccessException e) { return Hudson.ANONYMOUS; } }
/** * Gets the persisted authentication for this Hudson. * * @return {@link Hudson#ANONYMOUS} if no such credential is found, or if the stored credential is invalid. */ public Authentication get() { Hudson h = Hudson.getInstance(); Secret userName = Secret.decrypt(props.getProperty(getPropertyKey())); if (userName==null) return Hudson.ANONYMOUS; // failed to decrypt try { UserDetails u = h.getSecurityRealm().loadUserByUsername(userName.toString()); return new UsernamePasswordAuthenticationToken(u.getUsername(), u.getPassword(), u.getAuthorities()); } catch (AuthenticationException e) { return Hudson.ANONYMOUS; } catch (DataAccessException e) { return Hudson.ANONYMOUS; } }
/** * Gets the persisted authentication for this Hudson. * * @return {@link Hudson#ANONYMOUS} if no such credential is found, or if the stored credential is invalid. */ public Authentication get() { Hudson h = Hudson.getInstance(); Secret userName = Secret.decrypt(props.getProperty(getPropertyKey())); if (userName==null) return Hudson.ANONYMOUS; // failed to decrypt try { UserDetails u = h.getSecurityRealm().loadUserByUsername(userName.toString()); return new UsernamePasswordAuthenticationToken(u.getUsername(), u.getPassword(), u.getAuthorities()); } catch (AuthenticationException e) { return Hudson.ANONYMOUS; } catch (DataAccessException e) { return Hudson.ANONYMOUS; } }