public abstract class AbstractAuthorizable extends Object implements Authorizable
Authorizable| Modifier and Type | Field and Description |
|---|---|
protected String |
authorizableId |
protected String |
authorizablePath |
protected SecurityClient |
client |
ACTION_CREATE_GROUP, ACTION_CREATE_USER, AUTHORIZABLE_ID, IMPERSONATORS, IS_IMPERSONATED, MEMBER_OF, MEMBERS, PARAM_ADD_IMPERSONATORS, PARAM_ADD_MEMBERS, PARAM_AUTHORIZABLE_ID, PARAM_CREATE_GROUP, PARAM_CREATE_USER, PARAM_DELETE, PARAM_INTERMEDIATE_PATH, PARAM_PASSWORD, PARAM_REMOVE_IMPERSONATORS, PARAM_REMOVE_MEMBERS, PROFILE, SCHEMA_AUTHORIZABLE, SELECTOR, SELECTOR_USERPROPERTIES, TYPE, TYPE_GROUP, TYPE_USER, WILDCARD| Constructor and Description |
|---|
AbstractAuthorizable(T client,
String authorizableId)
Constructor for an
Authorizable,
default path to authorizable is expected |
| Modifier and Type | Method and Description |
|---|---|
protected Map<String,Authorizable> |
buildAuthorizableList(org.codehaus.jackson.JsonNode authorizableJsonNode)
Build list of
Authorizables as Map: key = id of
authorizable. |
static String |
buildAuthorizablePath(String authorizableId,
String rootPath,
String intermediatePath)
Get home path of the authorizable (user/group) in repository.
|
<T extends SecurityClient> |
create(T client,
Class<? extends AbstractAuthorizable> authorizableClass,
String authorizableId,
org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
Creates a new
Authorizable. |
org.apache.sling.testing.clients.SlingHttpResponse |
delete(int... expectedStatus)
Deletes an authorizable.
|
org.apache.sling.testing.clients.SlingHttpResponse |
doGet(List<org.apache.http.NameValuePair> parameters,
int... expectedStatus)
GET request to AuthorizableServlet.
|
org.apache.sling.testing.clients.SlingHttpResponse |
doPost(org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
POST request to AuthorizableServlet.
|
protected static String |
encodePathToURL(String authorizableHomePath)
Get url of the authorizable (user/group) in repository.
|
protected static String |
encodeURI(String unescapedPath)
Escape path to URI
|
boolean |
exists()
Check if the authorizable exists
|
static Class<? extends AbstractAuthorizable> |
getAuthorizableClass(String authorizableType)
Get authorizable Class.
|
SecurityClient |
getClient()
Get any client implementing the
SecurityClient |
String |
getHomePath()
Get home path to authorizable
|
String |
getHomeUrl()
Get home URL to authorizable
|
String |
getId()
Get id of authorizable
|
Map<String,Authorizable> |
getImpersonators()
Get impersonators of the authorizable.
|
String |
getJsonAsString(String propsFilter,
int... expectedStatus)
String representation of authorizable
http://localhost:4502/home/groups/default/administrators.rw.json?props=replication,modification,memberOf,
membersTotal,members,profile/*&ml=2000
|
Map<String,Authorizable> |
getMemberOf()
Get members authorizable is assigned to.
|
Map<String,Authorizable> |
getMembers()
Get members assigned to the authorizable.
|
org.codehaus.jackson.JsonNode |
getProfile()
Get profile attributes for authorizable.
|
String |
getUserPropertiesJsonAsString(int... expectedStatus)
Get user properties JSON representation as string
|
boolean |
isImpersonated()
Check if authorizable is impersonated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetRootPathprotected SecurityClient client
protected String authorizableId
protected String authorizablePath
public AbstractAuthorizable(T client,
String authorizableId)
throws org.apache.sling.testing.clients.ClientException,
InterruptedException
Authorizable,
default path to authorizable is expectedT - any class implementing teh SecurityClient.client - any class implementing the SecurityClient.authorizableId - the authorizable ID.org.apache.sling.testing.clients.ClientException - if the details of the authorizables cannot be retrievedInterruptedException - to mark this method as "waiting"public SecurityClient getClient()
AuthorizableSecurityClientgetClient in interface AuthorizableSecurityClientpublic String getId()
AuthorizablegetId in interface Authorizablepublic String getHomePath()
AuthorizablegetHomePath in interface Authorizablepublic String getHomeUrl()
AuthorizablegetHomeUrl in interface Authorizablepublic String getJsonAsString(String propsFilter, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
AuthorizablegetJsonAsString in interface AuthorizablepropsFilter - properties filterexpectedStatus - list of allowed HTTP Status to be returned.org.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic String getUserPropertiesJsonAsString(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
AuthorizablegetUserPropertiesJsonAsString in interface AuthorizableexpectedStatus - status to beorg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic boolean exists()
throws org.apache.sling.testing.clients.ClientException
Authorizableexists in interface Authorizableorg.apache.sling.testing.clients.ClientException - if the request failedpublic org.apache.sling.testing.clients.SlingHttpResponse delete(int... expectedStatus)
throws org.apache.sling.testing.clients.ClientException
Authorizabledelete in interface AuthorizableexpectedStatus - list of allowed HTTP Status to be returned.org.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic <T extends SecurityClient> Authorizable create(T client, Class<? extends AbstractAuthorizable> authorizableClass, String authorizableId, org.apache.sling.testing.clients.util.FormEntityBuilder formParameters, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
AuthorizableAuthorizable.create in interface AuthorizableT - client typeclient - any class implementing the SecurityClient.authorizableClass - Authorizable class to be created.authorizableId - the ID for the new authorizable.formParameters - form parameters.expectedStatus - list of allowed HTTP Status to be returned. If not set,
http status 201 (CREATED) is assumed.Authorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic Map<String,Authorizable> getMemberOf() throws org.apache.sling.testing.clients.ClientException, InterruptedException
AuthorizablegetMemberOf in interface AuthorizableAuthorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cycleInterruptedException - to mark this method as "waiting"public Map<String,Authorizable> getMembers() throws org.apache.sling.testing.clients.ClientException, InterruptedException
AuthorizablegetMembers in interface AuthorizableAuthorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cycleInterruptedException - to mark this method as "waiting"public Map<String,Authorizable> getImpersonators() throws org.apache.sling.testing.clients.ClientException, InterruptedException
AuthorizablegetImpersonators in interface AuthorizableAuthorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cycleInterruptedException - to mark this method as "waiting"public boolean isImpersonated()
throws org.apache.sling.testing.clients.ClientException
AuthorizableisImpersonated in interface Authorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic org.codehaus.jackson.JsonNode getProfile()
throws org.apache.sling.testing.clients.ClientException
AuthorizablegetProfile in interface Authorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic org.apache.sling.testing.clients.SlingHttpResponse doPost(org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
throws org.apache.sling.testing.clients.ClientException
formParameters - form parameters.expectedStatus - list of allowed HTTP Status to be returned.org.apache.sling.testing.clients.ClientException - if the request failedpublic org.apache.sling.testing.clients.SlingHttpResponse doGet(List<org.apache.http.NameValuePair> parameters, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
parameters - url parameters.expectedStatus - list of allowed HTTP Status to be returned.org.apache.sling.testing.clients.ClientException - if the request failedpublic static Class<? extends AbstractAuthorizable> getAuthorizableClass(String authorizableType)
authorizableType - Allowed values: "user" or "group" (fallback).AbstractAuthorizablepublic static String buildAuthorizablePath(String authorizableId, String rootPath, String intermediatePath) throws org.apache.sling.testing.clients.ClientException
authorizableId - the ID of the authorizablerootPath - the rootPath of the authorizableintermediatePath - the parent path the user will be created.org.apache.sling.testing.clients.ClientException - if the request failedprotected static String encodePathToURL(String authorizableHomePath) throws org.apache.sling.testing.clients.ClientException
JCR escaping works similar to URL encoding, meaning that special chars doGet %-encoded. so to avoid % being interpreted by the URL as an URL Encoding we must URL encode the % to doGet a valid URL
authorizableHomePath - the home path of the authorizableorg.apache.sling.testing.clients.ClientException - if the request failedprotected static String encodeURI(String unescapedPath) throws org.apache.sling.testing.clients.ClientException
unescapedPath - unescaped pathorg.apache.sling.testing.clients.ClientException - if the request failedprotected Map<String,Authorizable> buildAuthorizableList(org.codehaus.jackson.JsonNode authorizableJsonNode) throws org.apache.sling.testing.clients.ClientException, InterruptedException
Authorizables as Map: key = id of
authorizable.authorizableJsonNode - JSON node of an authorizable; TODO; formatAuthorizableorg.apache.sling.testing.clients.ClientException - if the request failedInterruptedException - to mark this method as "waiting"Copyright © 2018. All rights reserved.