Hold helper functions to retrive data from UG Rest Api
This project has the implementation of calling UG rest API. It will fetch users and groups data.
UG rest Api requires authentication token to send back data. For that, need to pass few connection parameters first to make sure that there will be no un-authorized response issue during fetching time of UG data set.
In ugRestApiHelper , connection properties needs to be set using initConnectionProperties method and in that method following parameters need to pass.
authorityURLneeds to pass to get access token. Make sure the url should be without/oauth2/token.clientIdneeds to pass to get access token.clientSecretneeds to pass to get access token.ugURLneeds to pass. This will be used while fetching UG data.subscriptionKeyneeds to pass. (Optional)
Note: Make sure ugURL is correct and authenticates the subscriptionKey that is passed.
If token is not expired then Api will use existing token to fetch the data otherwise it will generate a new token.
There are two data set supported so far.
- Users
- Groups
For groups to fetch there are two methods added.
-
getUGGroups This method will receive
groupFilterAttributeNamewhich indicates property name like 'name', 'kthid' etc,operatorToUseInFilterlike 'eq', 'contains', 'startswith' etc,groupFilterAttributeValuelike 'sst' (this will be the filter value to filter out the data) and there is a flagexpandMembers. If this set to true then it will fetch groups along with members. -
getUGGroupsByGroupName This method will bring groups along with members if needed. There is a flag
expandMembers. If this set to true then it will fetch groups along with members.groupNameneeds to pass because filter will preapplied to 'name' only.operatorToUseInFilteralso needed that how data should filter.
For user to fetch there is one method.
- getUGUsers
This method will receive
userFilterAttributeNamewhich indicates property name like 'givenName', 'kthid' etc,operatorToUseInFilterlike 'eq', 'contains', 'startswith' etc,userFilterAttributeValuelike 'Joakim' (this will be the filter value to filter out the data).
There are few filter operators that are supported so far.
- eq
- startswith
- contains
- in
Use on of these operators to filter out data.
TODO: There are other operators as well that is supported by UG Rest Api. Those will be including in the future.
Check the link below to see what are the supported filter by UG.