Skip to content

Commit

Permalink
bump to 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaFilipozzi committed Apr 9, 2024
1 parent 8799b25 commit 65f6926
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onEvent(Event event) {
if (event.getType() == EventType.LOGIN) {
RealmModel realm = session.realms().getRealm(event.getRealmId());
UserModel user = session.users().getUserById(realm, event.getUserId());
LOG.warnf(
LOG.tracef(
"setting %s on realm='%s' user='%s' userId='%s'",
ATTRIBUTE_NAME, realm.getName(), user.getUsername(), user.getId());
user.setSingleAttribute(ATTRIBUTE_NAME, Long.toString(Time.currentTimeMillis()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@ public void init(Config.Scope config) {

@Override
public void postInit(KeycloakSessionFactory factory) {
LOG.error("postInit() - entry");
factory.register(
event -> {
if (event instanceof PostMigrationEvent) {
LOG.error("postInit() - registering task");
LOG.debug("registering disable-users-task");
KeycloakSession session = factory.create();
TimerProvider timer = session.getProvider(TimerProvider.class);
timer.scheduleTask(this::disableUsers, taskInterval, "disable-users-task");
}
});
LOG.error("postInit() - entry");
}

@Override
Expand All @@ -86,15 +84,15 @@ private void disableUsers(KeycloakSession session) {
.forEach(
realm -> {
if (realm.getEventsListenersStream().noneMatch(x -> x.equals(PROVIDER_ID))) {
LOG.warnf(
LOG.debugf(
"realm='%s' does not have 'Login Event Listener' enabled", realm.getName());
return;
}

PasswordPolicy passwordPolicy = realm.getPasswordPolicy();
if (passwordPolicy == null
|| !passwordPolicy.getPolicies().contains("disable-users-password-policy")) {
LOG.warnf(
LOG.debugf(
"realm='%s' does not have 'Disable Users' password policy set",
realm.getName());
return;
Expand All @@ -104,7 +102,7 @@ private void disableUsers(KeycloakSession session) {

long gracePeriodMillis = gracePeriodDays * DAYS_TO_MILLIS;

LOG.warnf(
LOG.infof(
"checking realm='%s' for expired passwords or inactive accounts exceeding %d day(s)",
realm.getName(), gracePeriodDays);

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</scm>

<properties>
<revision>1.6.3</revision>
<revision>1.7.0</revision>
<github.account>LucaFilipozzi</github.account>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<keycloak.version>18.0.2</keycloak.version>
Expand Down

0 comments on commit 65f6926

Please sign in to comment.