/** * Create an instance of {@link LoginEventType } * */ public LoginEventType createLoginEventType() { return new LoginEventType(); }
/** * Creates a new {@code LoginEventType} instance by deeply copying a given {@code LoginEventType} instance. * * * @param o * The instance to copy. * @throws NullPointerException * if {@code o} is {@code null}. */ public LoginEventType(final LoginEventType o) { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 super(); if (o == null) { throw new NullPointerException("Cannot create a copy of 'LoginEventType' from 'null'."); } // CBuiltinLeafInfo: javax.xml.datatype.XMLGregorianCalendar this.timestamp = ((o.timestamp == null)?null:((o.getTimestamp() == null)?null:((XMLGregorianCalendar) o.getTimestamp().clone()))); // CBuiltinLeafInfo: java.lang.String this.from = ((o.from == null)?null:o.getFrom()); }
public LoginEventType from(String value) { setFrom(value); return this; }
XMLGregorianCalendar lastFailedLoginTs = null; if (lastFailedLogin != null) { lastFailedLoginTs = lastFailedLogin.getTimestamp(); LoginEventType event = new LoginEventType(); event.setTimestamp(clock.currentTimeXMLGregorianCalendar()); event.setFrom(connEnv.getRemoteHostAddress()); Duration lockoutDuration = credentialsPolicy.getLockoutDuration(); if (lockoutDuration != null) { lockoutExpirationTs = XmlTypeConverter.addDuration(event.getTimestamp(), lockoutDuration);
private void recordPasswordAuthenticationSuccess(MidPointPrincipal principal, ConnectionEnvironment connEnv, C passwordType, CredentialPolicyType passwordCredentialsPolicy) { Integer failedLogins = passwordType.getFailedLogins(); if (failedLogins != null && failedLogins > 0) { passwordType.setFailedLogins(0); } LoginEventType event = new LoginEventType(); event.setTimestamp(clock.currentTimeXMLGregorianCalendar()); event.setFrom(connEnv.getRemoteHostAddress()); passwordType.setPreviousSuccessfulLogin(passwordType.getLastSuccessfulLogin()); passwordType.setLastSuccessfulLogin(event); ActivationType activation = principal.getUser().getActivation(); if (activation != null) { activation.setLockoutStatus(LockoutStatusType.NORMAL); activation.setLockoutExpirationTimestamp(null); } userProfileService.updateUser(principal); recordAuthenticationSuccess(principal, connEnv); }
private boolean isLockoutExpired(AbstractCredentialType credentialsType, CredentialPolicyType credentialsPolicy) { Duration lockoutDuration = credentialsPolicy.getLockoutDuration(); if (lockoutDuration == null) { return false; } LoginEventType lastFailedLogin = credentialsType.getLastFailedLogin(); if (lastFailedLogin == null) { return true; } XMLGregorianCalendar lastFailedLoginTimestamp = lastFailedLogin.getTimestamp(); if (lastFailedLoginTimestamp == null) { return true; } XMLGregorianCalendar lockedUntilTimestamp = XmlTypeConverter.addDuration(lastFailedLoginTimestamp, lockoutDuration); return clock.isPast(lockedUntilTimestamp); }
public LoginEventType timestamp(XMLGregorianCalendar value) { setTimestamp(value); return this; }
public boolean equals(Object object) { final EqualsStrategy strategy = DomAwareEqualsStrategy.INSTANCE; return equals(null, null, object, strategy); }
public int hashCode() { final HashCodeStrategy strategy = DomAwareHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); }
} else if (value instanceof LoginEventType) { LoginEventType loginEventType = (LoginEventType) value; if (loginEventType.getTimestamp() != null) { return loginEventType.getTimestamp().toGregorianCalendar().getTime().toLocaleString(); // todo fix } else { return "";
/** * Create an instance of {@link LoginEventType } * */ public LoginEventType createLoginEventType() { return new LoginEventType(); }
public static String prettyPrint(LoginEventType loginEventType) { if (loginEventType == null) { return "null"; } StringBuilder sb = new StringBuilder("LoginEventType("); sb.append(prettyPrint(loginEventType.getTimestamp())); String from = loginEventType.getFrom(); if (from != null) { sb.append(" from ").append(from); } sb.append(")"); return sb.toString(); }
private void assertLastSuccessfulLogin(PrismObject<UserType> user, XMLGregorianCalendar startTs, XMLGregorianCalendar endTs) { LoginEventType lastSuccessfulLogin = getCredentialUsedForAuthentication(user.asObjectable()).getLastSuccessfulLogin(); assertNotNull("no last successful login in "+user, lastSuccessfulLogin); XMLGregorianCalendar successfulLoginTs = lastSuccessfulLogin.getTimestamp(); TestUtil.assertBetween("wrong last successful login timestamp", startTs, endTs, successfulLoginTs); }
/** * Create an instance of {@link LoginEventType } * */ public LoginEventType createLoginEventType() { return new LoginEventType(); }
/** * Creates and returns a deep copy of this object. * * * @return * A deep copy of this object. */ @Override public LoginEventType clone() { try { { // CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000 final LoginEventType clone = ((LoginEventType) super.clone()); // CBuiltinLeafInfo: javax.xml.datatype.XMLGregorianCalendar clone.timestamp = ((this.timestamp == null)?null:((this.getTimestamp() == null)?null:((XMLGregorianCalendar) this.getTimestamp().clone()))); // CBuiltinLeafInfo: java.lang.String clone.from = ((this.from == null)?null:this.getFrom()); return clone; } } catch (CloneNotSupportedException e) { // Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/ throw new AssertionError(e); } }
private void assertLastFailedLogin(PrismObject<UserType> user, XMLGregorianCalendar startTs, XMLGregorianCalendar endTs) { LoginEventType lastFailedLogin = getCredentialUsedForAuthentication(user.asObjectable()).getLastFailedLogin(); assertNotNull("no last failed login in "+user, lastFailedLogin); XMLGregorianCalendar failedLoginTs = lastFailedLogin.getTimestamp(); TestUtil.assertBetween("wrong last failed login timestamp", startTs, endTs, failedLoginTs); }
public LoginEventType beginLastFailedLogin() { LoginEventType value = new LoginEventType(); lastFailedLogin(value); return value; }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { XMLGregorianCalendar theTimestamp; theTimestamp = this.getTimestamp(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "timestamp", theTimestamp), currentHashCode, theTimestamp); } { String theFrom; theFrom = this.getFrom(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "from", theFrom), currentHashCode, theFrom); } return currentHashCode; }
public LoginEventType beginLastFailedLogin() { LoginEventType value = new LoginEventType(); lastFailedLogin(value); return value; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof LoginEventType)) { return false; } if (this == object) { return true; } final LoginEventType that = ((LoginEventType) object); { XMLGregorianCalendar lhsTimestamp; lhsTimestamp = this.getTimestamp(); XMLGregorianCalendar rhsTimestamp; rhsTimestamp = that.getTimestamp(); if (!strategy.equals(LocatorUtils.property(thisLocator, "timestamp", lhsTimestamp), LocatorUtils.property(thatLocator, "timestamp", rhsTimestamp), lhsTimestamp, rhsTimestamp)) { return false; } } { String lhsFrom; lhsFrom = this.getFrom(); String rhsFrom; rhsFrom = that.getFrom(); if (!strategy.equals(LocatorUtils.property(thisLocator, "from", lhsFrom), LocatorUtils.property(thatLocator, "from", rhsFrom), lhsFrom, rhsFrom)) { return false; } } return true; }