public List < Privilege > getPrivileges ( ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { cleanError ( ) ; prepareToken ( ) ; URIBuilder url = new URIBuilder ( settings . getURL ( Constants . LIST_PRIVILEGES_URL ) ) ; OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClient oAuthClient = new OAuthClient ( httpClient ) ; OAuthClientRequest bearerRequest = new OAuthBearerClientRequest ( url . toString ( ) ) . buildHeaderMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( ) ; bearerRequest . setHeaders ( headers ) ; List < Privilege > privileges = new ArrayList < Privilege > ( maxResults ) ; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient . resource ( bearerRequest , OAuth . HttpMethod . GET , OneloginOAuth2JSONResourceResponse . class ) ; if ( oAuth2Response . getResponseCode ( ) == 200 ) { JSONArray jsonArray = oAuth2Response . getJSONArrayFromContent ( ) ; if ( jsonArray != null && jsonArray . length ( ) > 0 ) { for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { privileges . add ( new Privilege ( jsonArray . getJSONObject ( i ) ) ) ; } } } else { error = oAuth2Response . getError ( ) ; errorDescription = oAuth2Response . getErrorDescription ( ) ; } return privileges ; }
Gets a list of the Privileges created in an account .