Hi everyone.
This is a branch from this question. Branched out because the original purpose of that question was something else.
I'm looking for the easiest way to check if a password is expired. A password will expire if its older than N days, where N is a value stored in another table.
My User class looks like this:
Security config:
loginUserDomainClass = "com.emp.app.user.User"
/**
* User domain class.
*/
class User {
static transients = ['pass','passwordExpired','credentialsNonExpired']
static hasMany = [authorities: Role]
static belongsTo = Role
/** Username */
String username
/** User Real Name*/
String userRealName
/** MD5 Password */
String passwd
/** enabled */
boolean enabled
String email
boolean emailShow
/** description */
String description = ''
/** plain password to create a MD5 password */
String pass = '[secret]'
static constraints = {
username(blank: false, unique: true)
userRealName(blank: false)
passwd(blank: false)
enabled()
}
public boolean isCredentialsNonExpired() {
//Check for the N value
return true;
}
}
I added the isCredentialsNonExpired() hoping it would be called on login, when credentials are checked, but it isnt. Is there a way for it to do so?
I'm quite confused about this, not sure if I have to write custom code to replace some acegi functionality or what.
Thanks in advance.