mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-36: Record and maintain password history.
This commit is contained in:
@@ -71,6 +71,19 @@ public class PostgreSQLPasswordPolicy implements PasswordPolicy {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The property which specifies the number of previous passwords remembered
|
||||
* for each user. If set to zero, the default, then this restriction does
|
||||
* not apply.
|
||||
*/
|
||||
private static final IntegerGuacamoleProperty HISTORY_SIZE =
|
||||
new IntegerGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "postgresql-user-password-history-size"; }
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The property which specifies whether all user passwords must have at
|
||||
* least one lowercase character and one uppercase character. By default,
|
||||
@@ -155,6 +168,11 @@ public class PostgreSQLPasswordPolicy implements PasswordPolicy {
|
||||
return environment.getProperty(MAX_AGE, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHistorySize() throws GuacamoleException {
|
||||
return environment.getProperty(HISTORY_SIZE, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultipleCaseRequired() throws GuacamoleException {
|
||||
return environment.getProperty(REQUIRE_MULTIPLE_CASE, false);
|
||||
|
@@ -63,7 +63,16 @@
|
||||
#{record.passwordHash,jdbcType=BINARY},
|
||||
#{record.passwordSalt,jdbcType=BINARY},
|
||||
#{record.passwordDate,jdbcType=TIMESTAMP}
|
||||
)
|
||||
);
|
||||
|
||||
DELETE FROM guacamole_user_password_history
|
||||
WHERE password_history_id IN (
|
||||
SELECT password_history_id
|
||||
FROM guacamole_user_password_history
|
||||
WHERE user_id = #{record.userID,jdbcType=INTEGER}
|
||||
ORDER BY password_date DESC
|
||||
OFFSET #{maxHistorySize}
|
||||
);
|
||||
|
||||
</insert>
|
||||
|
||||
|
Reference in New Issue
Block a user