Back to Notification Service Examples Page
This example demonstrates how the security feature of the Notification Service can be used. The example simulates a real-world situation where only certain privileged users can create notification channels. The example incorporates three security scenarios:
Note: All three example scenarios must be run in the order that they listed above.
This example uses a single program:
RetrieveChannel.java
locates an unused event channel and attempts to use it. It can take
an optional argument which it uses as its credential. If no argument is
provided, then a default credential is used. The program uses two
operations on the org.omg.CosNotifyChannelAdmin.EventChannelFactoryOperations
interface.
The first, get_event_channel
, is used to locate a new unused
event channel. The second, create_channel
, is used to create
a new event channel.
<INSTALL_DIR>/bin
directory:
manager
OpenFusion.NotificationRetrieveChannel
POA is registered.
run com.prismt.cos.CosNotification.examples.Security.RetrieveChannel
The RetrieveChannel program will attempt to create a new event channel. It will
display "Event channel created and returned successfully
"
upon successful execution of the program.
<INSTALL_DIR>
is the OpenFusion installation directory.
XMLGroupPersistence
|
file:<INSTALL_DIR>/examples/config/grouppersistence.xml
|
XMLPrincipalPersistence
|
file:<INSTALL_DIR>/examples/config/principalpersistence.xml
|
JAASConfigurationFile
|
file:<INSTALL_DIR>/examples/config/jaas_config
|
XMLACLPersistence
|
file:<INSTALL_DIR>/examples/config/accessentry.xml
|
SecurityCredentialFile
|
file:<INSTALL_DIR>/examples/userdata.xml
|
SecurityPropertiesFile
|
file:<INSTALL_DIR>/examples/config/SecurityProperties.xml
|
org.omg.CosNotifyChannelAdmin.EventChannelFactoryOperations
interface node in the left pane. This will provide you with a list of
operations that are contained within this interface. Click on the
create_channel operation. This will display the security principals
that are associated with the operation. None should be present at this stage.
run -s com.prismt.cos.CosNotification.examples.Security.RetrieveChannel
The RetrieveChannel program should attempt to create an event channel.
The program successfully locates an unused event channel as we have not secured
the get_event_channel method
. However, it fails to create a new
event channel, displaying the message "Permission not granted to create a
channel". This is because we do not have the correct credentials
to execute the create_channel method.
run -s com.prismt.cos.CosNotification.examples.Security.RetrieveChannel adminuser adminPass
The RetrieveChannel program should create a new event channel successfully, displaying the message "Event channel created and returned successfully".
org.omg.CosNotifyChannelAdmin.EventChannelFactoryOperations
interface node in the left pane. This will display the security principals
that are associated with this interface. None should be present at this
stage.
run -s com.prismt.cos.CosNotification.examples.Security.RetrieveChannel
The RetrieveChannel program should attempt to create an event channel.
However, it should fail and display the message "Permission not granted to
retrieve a channel". This is because the correct credentials have not
been provided for allowing execution any operation on the
org.omg.CosNotifyChannelAdmin.EventChannelFactoryOperations
interface. The program requires this interface to locate an unused channel
and create a new channel.
run -s com.prismt.cos.CosNotification.examples.Security.RetrieveChannel rootuser rootPass
The RetrieveChannel program should create a new event channel successfully and display the message "Event channel created and returned successfully".