Class DataStore
- java.lang.Object
-
- com.sun.identity.entitlement.opensso.DataStore
-
public class DataStore extends Object
This class *talks* to SMS to get the configuration information.
-
-
Field Summary
Fields Modifier and Type Field Description static String
POLICY_STORE
static String
REFERRAL_APPLS
static String
REFERRAL_REALMS
static String
REFERRAL_STORE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
add(Subject adminSubject, String realm, Privilege p)
Adds a privilege.String
addReferral(Subject adminSubject, String realm, ReferralPrivilege referral)
Adds a referral.static DataStore
getInstance()
static int
getNumberOfPolicies()
static int
getNumberOfPolicies(String realm)
static int
getNumberOfReferrals()
static int
getNumberOfReferrals(String realm)
IPrivilege
getPrivilege(String realm, String privilegeIdentifier)
Retrieves an individual privilege from the data store.static String
getPrivilegeDistinguishedName(String name, String realm, String indexName)
Returns distingished name of a privilege.static String
getSearchBaseDN(String realm, String indexName)
Returns the base search DN.boolean
hasPrivilgesWithApplication(Subject adminSubject, String realm, String applName)
void
remove(Subject adminSubject, String realm, String name)
Removes privilege.void
removeReferral(Subject adminSubject, String realm, String name)
Removes referral privilege.Set<IPrivilege>
search(Subject adminSubject, String realm, BufferedIterator iterator, ResourceSearchIndexes indexes, Set<String> subjectIndexes, boolean bSubTree, Set<String> excludeDNs)
Returns a set of privilege that satifies the resource and subject indexes.Set<String>
search(Subject adminSubject, String realm, String filter, int numOfEntries, boolean sortResults, boolean ascendingOrder)
Returns a set of privilege names that satifies a search filter.Set<ReferralPrivilege>
searchReferral(SSOToken adminToken, String realm, BufferedIterator iterator, ResourceSearchIndexes indexes, boolean bSubTree, Set<String> excludeDNs)
Returns a set of referral privilege that satifies the resource and subject indexes.Set<String>
searchReferral(Subject adminSubject, String realm, String filter, int numOfEntries, boolean sortResults, boolean ascendingOrder)
Returns a set of referral privilege names that satifies a search filter.Set<ReferralPrivilege>
searchReferrals(SSOToken adminToken, String realm, String filter)
-
-
-
Field Detail
-
POLICY_STORE
public static final String POLICY_STORE
- See Also:
- Constant Field Values
-
REFERRAL_STORE
public static final String REFERRAL_STORE
- See Also:
- Constant Field Values
-
REFERRAL_REALMS
public static final String REFERRAL_REALMS
- See Also:
- Constant Field Values
-
REFERRAL_APPLS
public static final String REFERRAL_APPLS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static DataStore getInstance()
-
getPrivilegeDistinguishedName
public static String getPrivilegeDistinguishedName(String name, String realm, String indexName)
Returns distingished name of a privilege.- Parameters:
name
- Privilege name.realm
- Realm name.indexName
- Index name.- Returns:
- the distingished name of a privilege.
-
getSearchBaseDN
public static String getSearchBaseDN(String realm, String indexName)
Returns the base search DN.- Parameters:
realm
- Realm name.indexName
- Index name.- Returns:
- the base search DN.
-
getNumberOfPolicies
public static int getNumberOfPolicies()
-
getNumberOfReferrals
public static int getNumberOfReferrals()
-
getNumberOfPolicies
public static int getNumberOfPolicies(String realm)
-
getNumberOfReferrals
public static int getNumberOfReferrals(String realm)
-
add
public String add(Subject adminSubject, String realm, Privilege p) throws EntitlementException
Adds a privilege.- Parameters:
adminSubject
- Admin Subject who has the rights to write to datastore.realm
- Realm name.p
- Privilege object.- Returns:
- the DN of added privilege.
- Throws:
EntitlementException
- if privilege cannot be added.
-
addReferral
public String addReferral(Subject adminSubject, String realm, ReferralPrivilege referral) throws EntitlementException
Adds a referral.- Parameters:
adminSubject
- Admin Subject who has the rights to write to datastore.realm
- Realm name.referral
- Referral Privilege object.- Returns:
- the DN of added privilege.
- Throws:
EntitlementException
- if privilege cannot be added.
-
remove
public void remove(Subject adminSubject, String realm, String name) throws EntitlementException
Removes privilege.- Parameters:
adminSubject
- Admin Subject who has the rights to write to datastore.realm
- Realm name.name
- Privilege name.- Throws:
EntitlementException
- if privilege cannot be removed.
-
removeReferral
public void removeReferral(Subject adminSubject, String realm, String name) throws EntitlementException
Removes referral privilege.- Parameters:
adminSubject
- Admin Subject who has the rights to write to datastore.realm
- Realm name.name
- Referral privilege name.- Throws:
EntitlementException
- if privilege cannot be removed.
-
search
public Set<String> search(Subject adminSubject, String realm, String filter, int numOfEntries, boolean sortResults, boolean ascendingOrder) throws EntitlementException
Returns a set of privilege names that satifies a search filter.- Parameters:
adminSubject
- Subject who has the rights to read datastore.realm
- Realm namefilter
- Search filter.numOfEntries
- Number of max entries.sortResults
-true
to have result sorted.ascendingOrder
-true
to have result sorted in ascending order.- Returns:
- a set of privilege names that satifies a search filter.
- Throws:
EntitlementException
- if search failed.
-
searchReferral
public Set<String> searchReferral(Subject adminSubject, String realm, String filter, int numOfEntries, boolean sortResults, boolean ascendingOrder) throws EntitlementException
Returns a set of referral privilege names that satifies a search filter.- Parameters:
adminSubject
- Subject who has the rights to read datastore.realm
- Realm namefilter
- Search filter.numOfEntries
- Number of max entries.sortResults
-true
to have result sorted.ascendingOrder
-true
to have result sorted in ascending order.- Returns:
- a set of privilege names that satifies a search filter.
- Throws:
EntitlementException
- if search failed.
-
hasPrivilgesWithApplication
public boolean hasPrivilgesWithApplication(Subject adminSubject, String realm, String applName) throws EntitlementException
- Throws:
EntitlementException
-
search
public Set<IPrivilege> search(Subject adminSubject, String realm, BufferedIterator iterator, ResourceSearchIndexes indexes, Set<String> subjectIndexes, boolean bSubTree, Set<String> excludeDNs) throws EntitlementException
Returns a set of privilege that satifies the resource and subject indexes.- Parameters:
adminSubject
- Subject who has the rights to read datastore.realm
- Realm nameiterator
- Buffered iterator to have the result fed to it.indexes
- Resource search indexes.subjectIndexes
- Subject search indexes.bSubTree
-true
to do sub tree searchexcludeDNs
- Set of DN to be excluded from the search results.- Returns:
- a set of privilege that satifies the resource and subject indexes.
- Throws:
EntitlementException
-
getPrivilege
public IPrivilege getPrivilege(String realm, String privilegeIdentifier) throws EntitlementException
Retrieves an individual privilege from the data store. The privilege is returned by the method and also added to the passed in iterator.- Parameters:
realm
- Realm in which the privilege exists.privilegeIdentifier
- The identifier of the privilege to retrieve.- Returns:
- the privilege.
- Throws:
EntitlementException
- if there were issues retrieving the privilege from the data store.
-
searchReferral
public Set<ReferralPrivilege> searchReferral(SSOToken adminToken, String realm, BufferedIterator iterator, ResourceSearchIndexes indexes, boolean bSubTree, Set<String> excludeDNs) throws EntitlementException
Returns a set of referral privilege that satifies the resource and subject indexes.- Parameters:
adminToken
- Subject who has the rights to read datastore.realm
- Realm nameiterator
- Buffered iterator to have the result fed to it.indexes
- Resource search indexes.bSubTree
-true
to do sub tree searchexcludeDNs
- Set of DN to be excluded from the search results.- Returns:
- a set of privilege that satifies the resource and subject indexes.
- Throws:
EntitlementException
-
searchReferrals
public Set<ReferralPrivilege> searchReferrals(SSOToken adminToken, String realm, String filter) throws EntitlementException
- Throws:
EntitlementException
-
-