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;
	}
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.

@return List of Privilege

@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the getResource call

@see com.onelogin.sdk.model.Privileges
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/privileges/list-privileges">Get Privileges documentation</a>