Interface PermissionMessage
- All Superinterfaces:
Message
Interface that represents a Permission message.
Permission messages are a type of DataSource subject that can be used to send information to both a StreamLink client and to the Authentication Module within the Liberator. They are intended to be used for conveying information about permissions that govern a client application's (and hence end-user's) access to data and functionality.
A Permission message can be conceived as a 2-dimensional array (like a
RecordType2Message
), or a table structure, with
the PermissionKey
as the secondary index and the field/value pairs as column
keys+values. The following table is an illustration of how they could be utilized by your
DataSource, Authentication Module, and StreamLink clients.
PermissionKey |
Read |
Write |
Delete |
PERMZONE1 | YES | YES | YES |
PERMZONE1 | YES | YES | NO |
PERMZONE1 | YES | NO | NO |
An instance of PermissionMessage
must define the key field for the permission
message. Any number of field/value pairs can then be defined after the key field.
Permission messages have the unique feature of being passed through the Authentication Module in the Liberator prior to being sent to StreamLink clients.
The Authentication Module can take actions based on the content of the permission messages it receives. For example, if a permission message determines the price tier to which a customer belongs, the Authentication Module could retain the tier information for future reference and prevent the message from being forwarded to the subscribing client (since this information should not be made available to customers).
Permission messages marked as "Global" are also passed into the Authentication Module within the Liberator when received from a DataSource. Such messages are typically used to provide the Authentication Module with authentication and authorization information about customers (such as username and password).
An object implementing this interface cannot be instantiated directly, but can be constructed
using the MessageFactory
that is available on the
Publisher
interface.
Note: After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsField
(String fieldName) Determines whether the permission message contains the specified field.boolean
Gets a value indicating whether this permission message specifies that the permission key should be deleted from the Liberator's cache.Gets a specified field within this permission message.Gets the fields within this permission message.boolean
Gets a value indicating whether thisPermissionMessage
is a global permission message.Gets the permission key.void
removeField
(String fieldName) Removes all instances of the given field from this permission message.void
setDeletePermissionKey
(boolean value) Sets a value in this permission message indicating whether the permission key must be deleted from Liberator's cache.void
Sets a specified field within this permission message.void
setGlobal
(boolean value) Sets a value indicating whether thisPermissionMessage
is a global permission message.void
setPermissionKey
(String value) Sets the permission key.Methods inherited from interface com.caplin.datasource.messaging.Message
getMessageType, getSubject, isImage, setImage
-
Method Details
-
getPermissionKey
String getPermissionKey()Gets the permission key.
- Returns:
- The permission key.
-
setPermissionKey
Sets the permission key.
- Parameters:
value
- The permission key.
-
getGlobal
boolean getGlobal()Gets a value indicating whether this
PermissionMessage
is a global permission message.- Returns:
true
if global; otherwise,false
.
-
setGlobal
void setGlobal(boolean value) Sets a value indicating whether this
PermissionMessage
is a global permission message.- Parameters:
value
-true
if global; otherwise,false
.
-
getDeletePermissionKey
boolean getDeletePermissionKey()Gets a value indicating whether this permission message specifies that the permission key should be deleted from the Liberator's cache.
- Returns:
true
if the permission key is to be deleted from the Liberator's cache; otherwise,false
.
-
setDeletePermissionKey
void setDeletePermissionKey(boolean value) Sets a value in this permission message indicating whether the permission key must be deleted from Liberator's cache.
- Parameters:
value
-true
if the permission key must be deleted from the Liberator's cache; otherwise,false
.
-
removeField
Removes all instances of the given field from this permission message.
- Parameters:
fieldName
- The name of the field.
-
containsField
Determines whether the permission message contains the specified field.
- Parameters:
fieldName
- The name of the field.- Returns:
true
if the message contains the field; otherwise,false
.
-
getField
Gets a specified field within this permission message.
If multiple occurrences of the field have been added with the same name the method returns the value of the last occurrence.
- Parameters:
fieldName
- The name of the field.- Returns:
- A specified field within this permission message.
-
setField
Sets a specified field within this permission message.
If the field does not exist in the permission message, the method adds it, otherwise it updates the value of the existing field.
- Parameters:
fieldName
- The name of the field.value
- The value of the field.
-
getFields
Gets the fields within this permission message.
- Returns:
- A read-only list of the fields within this permission message.
-