Skip to content

Commit d4229a4

Browse files
committed
Add access-extension-notification scheduled task sample for OIG
1 parent 732e84a commit d4229a4

File tree

6 files changed

+689
-0
lines changed

6 files changed

+689
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2023 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Access Extension Notification Scheduled Task
2+
3+
This asset contains the code and deployment items for a scheduled task designed to notify users of any expiring access and to allow them to extend expiration dates by a set number of days. This is achieved by including unique actionable links in the notification emails.
4+
5+
The scheduled task needs to be used in conjunction with the Extend Access WebService in order to provide the end-to-end access extension functionality.
6+
7+
Developed on and compatible with OIG 11g R2 PS3 and above.
8+
9+
## When to use this asset?
10+
11+
When there's a need to provide or demonstrate the functionality described above or something similar, which can be adapted from the provided code.
12+
13+
## How to use this asset?
14+
15+
### Pre-requisites and dependencies
16+
17+
The scheduled task uses the `javax.mail` interface in order to send emails, and also parts of the `jaxb-api` interface for generating UUIDs.
18+
19+
As such, the following jar files are required as dependencies and need to be used during the build process, **and also uploaded as third party jars** to the OIM deployment node:
20+
- javax.mail.jar
21+
- jaxb-api-2.3.1.jar
22+
23+
### Building and deployment
24+
25+
Here's a short build and deployment checklist:
26+
27+
1. Use an SQL client, such as SQLDeveloper, to connect to the OIM DB schema (e.g. DEV_OIM) and execute `EXTEND_ACCESS.sql` to create the required data table
28+
2. Import any additional artifacts using deployment manager, such as the `Access_Extension_Template.xml` file
29+
3. Generate a jar file containing the sample code.
30+
4. Upload the jar file to an OIG environment using OIG's command line "Jar Upload" utility. Also remember to upload the dependencies as "3. ThirdParty" jars.
31+
5. Use the Enterprise Manager web interface to upload the scheduled task metadata/definition into the MDS repository.
32+
6. Create a scheduled task in OIG based on the uploaded definition.
33+
34+
Please see the useful link below for detailed build and deployment steps.
35+
36+
### Executing the scheduled task
37+
38+
The following items need to be populated as part of the scheduled job parameters:
39+
- Days Before Expiration: Number of days before the email is sent, e.g. 7
40+
- Extension Days: Extension days to be added to existing end dates, e.g. 60
41+
- Extension Link Text: Text to be included part of the actionable extension links, e.g. Click here to extend access
42+
- REST WS Endpoint URL: Endpoint URL for the access extension REST webservice, e.g. http://127.0.0.1:14000/extend_access/rest
43+
- Email Template Name: Email template name for the email, e.g. Access_Extension_Template
44+
- SMTP Mail Server Hostname: Hostname of the SMTP Mail server, e.g. localhost
45+
- SMTP Mail Server TLS: Enable or disable SMTP TLS, e.g. No
46+
- SMTP Mail Server Port: Port of the SMTP Mail server, e.g. 25
47+
48+
[Consult this section](https://docs.oracle.com/en/middleware/idm/identity-governance/12.2.1.4/omusg/managing-jobs-1.html#GUID-71BB3623-AEE2-4F64-BBD4-D921DCA39D7C) on how to manually start or schedule a job.
49+
50+
## Useful Links
51+
52+
[Oracle Identity Governance developer's guide - Developing scheduled tasks](https://docs.oracle.com/en/middleware/idm/identity-governance/12.2.1.4/omdev/developing-scheduled-tasks.html#GUID-F62EF833-1E70-41FC-9DCC-C1EAB407D151)
53+
54+
# License
55+
56+
Copyright (c) 2023 Oracle and/or its affiliates.
57+
58+
Licensed under the Universal Permissive License (UPL), Version 1.0.
59+
60+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
3+
<task>
4+
<name>Access Extension Notification</name>
5+
<class>com.oracle.sample.AccessExtensionNotification</class>
6+
<description>Access Extension Notification</description>
7+
<retry>1</retry>
8+
<parameters>
9+
<string-param required="true" encrypted="false" helpText="Number of days before the email is sent.">Days Before Expiration</string-param>
10+
<string-param required="true" encrypted="false" helpText="Extension days to be added to existing end dates.">Extension Days</string-param>
11+
<string-param required="true" encrypted="false" helpText="Text to be included part of the actionable extension links">Extension Link Text</string-param>
12+
<string-param required="true" encrypted="false" helpText="Endpoint URL for the access extension REST webservice.">REST WS Endpoint URL</string-param>
13+
<string-param required="true" encrypted="false" helpText="Email template name for the email.">Email Template Name</string-param>
14+
<string-param required="true" encrypted="false" helpText="Hostname of the SMTP Mail server.">SMTP Mail Server Hostname</string-param>
15+
<boolean-param required="true" encrypted="false" helpText="Enable or disable SMTP TLS.">SMTP Mail Server TLS</boolean-param>
16+
<string-param required="true" encrypted="false" helpText="Port of the SMTP Mail server (typically 25).">SMTP Mail Server Port</string-param>
17+
</parameters>
18+
</task>
19+
</scheduledTasks>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version = '1.0' encoding = 'UTF-8'?>
2+
<xl-ddm-data version="12.2.1.4.0" user="XELSYSADM" database="" exported-date="1692272039167" description="Access_Extension_Template.xml"><NOTIFICATIONTEMPLATE repo-type="RDBMS" name="Access_Extension_Template"><CREATEUSER>1</CREATEUSER><CREATIONDATE>1614848134174</CREATIONDATE><DATALEVEL>0</DATALEVEL><EVENTNAME>EndDateNotificationEvent</EVENTNAME><LASTUSER>xelsysadm</LASTUSER><LASTUPDATED>1692180967014</LASTUPDATED><LOCALTEMPLATE repo-type="RDBMS" id="LOCALTEMPLATE481"><CREATEUSER>1</CREATEUSER><CONTENTTYPE>html</CONTENTTYPE><CREATIONDATE>1614848134282</CREATIONDATE><LOCALE>en_US</LOCALE><DATALEVEL>0</DATALEVEL><ENCODING>UTF-8</ENCODING><SUBJECT>Your access is expiring</SUBJECT><LONGMESSAGE>&lt;p>Hi $display_name,&lt;/p>
3+
4+
&lt;p>Some of your access is expiring in $days day(s). Please find below a list of expiring access items.&lt;/p>
5+
6+
&lt;p>$expiring_items&lt;/p>
7+
8+
&lt;p>Kind regards,&lt;br>
9+
Your friendly OIM admin&lt;/p></LONGMESSAGE><LASTUSER>xelsysadm</LASTUSER><LASTUPDATED>1692180967018</LASTUPDATED></LOCALTEMPLATE></NOTIFICATIONTEMPLATE></xl-ddm-data>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE EXTEND_ACCESS
2+
("EXT_UUID" VARCHAR2(255 CHAR) NOT NULL ENABLE,
3+
"EXT_USR_KEY" NUMBER NOT NULL ENABLE,
4+
"EXT_ACCESS_ID" NUMBER NOT NULL ENABLE,
5+
"EXT_INSTANCE_ID" NUMBER NOT NULL ENABLE,
6+
"EXT_INSTANCE_TYPE" VARCHAR2(255 CHAR) NOT NULL ENABLE,
7+
"EXT_INSTANCE_NAME" VARCHAR2(255 CHAR) NOT NULL ENABLE,
8+
"EXT_ACCESS_END_DATE" DATE NOT NULL ENABLE,
9+
CONSTRAINT "EXTEND_ACCESS_PK" PRIMARY KEY ("EXT_UUID")
10+
);

0 commit comments

Comments
 (0)