forked from OpenIdentityPlatform/OpenAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AME-12299 integrated session notifications with a new DJ backed notif…
…ication broker
- Loading branch information
Showing
23 changed files
with
772 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
openam-core/src/main/java/org/forgerock/openam/notifications/NotificationsConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2016 ForgeRock AS. | ||
*/ | ||
|
||
package org.forgerock.openam.notifications; | ||
|
||
import static com.sun.identity.shared.Constants.NOTIFICATIONS_AGENTS_ENABLED; | ||
|
||
import com.iplanet.am.util.SystemProperties; | ||
import com.sun.identity.common.configuration.ConfigurationListener; | ||
|
||
/** | ||
* Provides notifications configuration. | ||
* | ||
* @since 14.0.0 | ||
*/ | ||
public enum NotificationsConfig { | ||
|
||
INSTANCE; | ||
|
||
private volatile boolean agentsEnabled; | ||
|
||
NotificationsConfig() { | ||
SystemProperties.observe(new ConfigurationListener() { | ||
|
||
@Override | ||
public void notifyChanges() { | ||
agentsEnabled = SystemProperties.getAsBoolean(NOTIFICATIONS_AGENTS_ENABLED, true); | ||
} | ||
|
||
}, NOTIFICATIONS_AGENTS_ENABLED); | ||
|
||
agentsEnabled = SystemProperties.getAsBoolean(NOTIFICATIONS_AGENTS_ENABLED, true); | ||
} | ||
|
||
/** | ||
* Whether notifications for agents is enabled. | ||
* | ||
* @return whether notifications for agents is enabled | ||
*/ | ||
public boolean isAgentsEnabled() { | ||
return agentsEnabled; | ||
} | ||
|
||
} |
93 changes: 93 additions & 0 deletions
93
openam-core/src/main/java/org/forgerock/openam/session/SessionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* The contents of this file are subject to the terms of the Common Development and | ||
* Distribution License (the License). You may not use this file except in compliance with the | ||
* License. | ||
* | ||
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
* specific language governing permission and limitations under the License. | ||
* | ||
* When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
* Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
* information: "Portions copyright [year] [name of copyright owner]". | ||
* | ||
* Copyright 2016 ForgeRock AS. | ||
*/ | ||
|
||
package org.forgerock.openam.session; | ||
|
||
/** | ||
* Represents a session event. | ||
* <p> | ||
* Maps from {@link com.iplanet.dpro.session.SessionEvent} to a session event enum. | ||
* | ||
* @since 14.0.0 | ||
*/ | ||
public enum SessionEvent { | ||
|
||
SESSION_CREATION(com.iplanet.dpro.session.SessionEvent.SESSION_CREATION), | ||
|
||
/** | ||
* Session idle time out event | ||
*/ | ||
IDLE_TIMEOUT(com.iplanet.dpro.session.SessionEvent.IDLE_TIMEOUT), | ||
|
||
/** | ||
* Session maximum time out event | ||
*/ | ||
MAX_TIMEOUT(com.iplanet.dpro.session.SessionEvent.MAX_TIMEOUT), | ||
|
||
/** | ||
* Session logout event | ||
*/ | ||
LOGOUT(com.iplanet.dpro.session.SessionEvent.LOGOUT), | ||
|
||
/** | ||
* Session reactivation event | ||
*/ | ||
REACTIVATION(com.iplanet.dpro.session.SessionEvent.REACTIVATION), | ||
|
||
/** | ||
* Session destroy event | ||
*/ | ||
DESTROY(com.iplanet.dpro.session.SessionEvent.DESTROY), | ||
|
||
/** | ||
* Session Property changed | ||
*/ | ||
PROPERTY_CHANGED(com.iplanet.dpro.session.SessionEvent.PROPERTY_CHANGED), | ||
|
||
/** | ||
* Session quota exhausted | ||
*/ | ||
QUOTA_EXHAUSTED(com.iplanet.dpro.session.SessionEvent.QUOTA_EXHAUSTED), | ||
|
||
/** | ||
* Session property protected against change | ||
*/ | ||
PROTECTED_PROPERTY(com.iplanet.dpro.session.SessionEvent.PROTECTED_PROPERTY); | ||
|
||
private final int sessionEventId; | ||
|
||
SessionEvent(int sessionEventId) { | ||
this.sessionEventId = sessionEventId; | ||
} | ||
|
||
/** | ||
* Given the session event Id will return the corresponding session event enum. | ||
* | ||
* @param sessionEventId the session event Id | ||
* @return the corresponding session event enum | ||
* @throws IllegalArgumentException if the session event Id is not valid | ||
*/ | ||
public static SessionEvent valueOf(int sessionEventId) { | ||
for (SessionEvent event : values()) { | ||
if (event.sessionEventId == sessionEventId) { | ||
return event; | ||
} | ||
} | ||
|
||
throw new IllegalArgumentException("Unknown session event Id " + sessionEventId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.