Interface Authorizable
-
- All Known Implementing Classes:
AbstractAuthorizable,Group,User
public interface AuthorizableInterface which defines an authorizable: user / group
-
-
Field Summary
Fields Modifier and Type Field Description static intACTION_CREATE_GROUPstatic intACTION_CREATE_USERstatic StringAUTHORIZABLE_IDJSON propertiesstatic StringHOMEstatic StringIMPERSONATORSstatic StringIS_IMPERSONATEDstatic StringMEMBER_OFstatic StringMEMBERSstatic StringPARAM_ADD_IMPERSONATORSstatic StringPARAM_ADD_MEMBERSstatic StringPARAM_AUTHORIZABLE_IDstatic StringPARAM_CREATE_GROUPParameter marking the request being used for creating a new group.static StringPARAM_CREATE_USERParameter marking the request being used for creating a new user.static StringPARAM_DELETEParameter indicating that the corresponding authorizable should be removed.static StringPARAM_INTERMEDIATE_PATHstatic StringPARAM_PASSWORDstatic StringPARAM_REMOVE_IMPERSONATORSstatic StringPARAM_REMOVE_MEMBERSstatic StringPROFILEstatic StringSCHEMA_AUTHORIZABLEJSON Schema from authorizable (minimum)static StringSELECTORSelector for AuthorizableServletstatic StringSELECTOR_USERPROPERTIESSelector for UserPropertiesstatic StringTYPEstatic StringTYPE_GROUPstatic StringTYPE_USERstatic StringWILDCARD
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends SecurityClient>
Authorizablecreate(T client, Class<? extends AbstractAuthorizable> authorizableClass, String authorizableId, org.apache.sling.testing.clients.util.FormEntityBuilder formParameters, int... expectedStatus)Creates a newAuthorizable.org.apache.sling.testing.clients.SlingHttpResponsedelete(int... expectedStatus)Deletes an authorizable.booleanexists()Check if the authorizable existsSecurityClientgetClient()Get any client implementing theSecurityClientStringgetHomePath()Get home path to authorizableStringgetHomeUrl()Get home URL to authorizableStringgetId()Get id of authorizableMap<String,Authorizable>getImpersonators()Get impersonators of the authorizable.StringgetJsonAsString(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=2000Map<String,Authorizable>getMemberOf()Get members authorizable is assigned to.Map<String,Authorizable>getMembers()Get members assigned to the authorizable.com.fasterxml.jackson.databind.JsonNodegetProfile()Get profile attributes for authorizable.StringgetRootPath()Get root path of the authorizable (user/group) in repositoryStringgetUserPropertiesJsonAsString(int... expectedStatus)Get user properties JSON representation as stringbooleanisImpersonated()Check if authorizable is impersonated.
-
-
-
Field Detail
-
SCHEMA_AUTHORIZABLE
static final String SCHEMA_AUTHORIZABLE
JSON Schema from authorizable (minimum)- See Also:
- Constant Field Values
-
SELECTOR
static final String SELECTOR
Selector for AuthorizableServlet- See Also:
- Constant Field Values
-
SELECTOR_USERPROPERTIES
static final String SELECTOR_USERPROPERTIES
Selector for UserProperties- See Also:
- Constant Field Values
-
PARAM_DELETE
static final String PARAM_DELETE
Parameter indicating that the corresponding authorizable should be removed.- See Also:
- Constant Field Values
-
PARAM_CREATE_USER
static final String PARAM_CREATE_USER
Parameter marking the request being used for creating a new user.- See Also:
- Constant Field Values
-
PARAM_CREATE_GROUP
static final String PARAM_CREATE_GROUP
Parameter marking the request being used for creating a new group.- See Also:
- Constant Field Values
-
ACTION_CREATE_USER
static final int ACTION_CREATE_USER
- See Also:
- Constant Field Values
-
ACTION_CREATE_GROUP
static final int ACTION_CREATE_GROUP
- See Also:
- Constant Field Values
-
PARAM_AUTHORIZABLE_ID
static final String PARAM_AUTHORIZABLE_ID
- See Also:
- Constant Field Values
-
PARAM_PASSWORD
static final String PARAM_PASSWORD
- See Also:
- Constant Field Values
-
PARAM_INTERMEDIATE_PATH
static final String PARAM_INTERMEDIATE_PATH
- See Also:
- Constant Field Values
-
PARAM_ADD_IMPERSONATORS
static final String PARAM_ADD_IMPERSONATORS
- See Also:
- Constant Field Values
-
PARAM_REMOVE_IMPERSONATORS
static final String PARAM_REMOVE_IMPERSONATORS
- See Also:
- Constant Field Values
-
PARAM_ADD_MEMBERS
static final String PARAM_ADD_MEMBERS
- See Also:
- Constant Field Values
-
PARAM_REMOVE_MEMBERS
static final String PARAM_REMOVE_MEMBERS
- See Also:
- Constant Field Values
-
AUTHORIZABLE_ID
static final String AUTHORIZABLE_ID
JSON properties- See Also:
- Constant Field Values
-
HOME
static final String HOME
- See Also:
- Constant Field Values
-
IS_IMPERSONATED
static final String IS_IMPERSONATED
- See Also:
- Constant Field Values
-
MEMBERS
static final String MEMBERS
- See Also:
- Constant Field Values
-
MEMBER_OF
static final String MEMBER_OF
- See Also:
- Constant Field Values
-
PROFILE
static final String PROFILE
- See Also:
- Constant Field Values
-
IMPERSONATORS
static final String IMPERSONATORS
- See Also:
- Constant Field Values
-
TYPE
static final String TYPE
- See Also:
- Constant Field Values
-
TYPE_GROUP
static final String TYPE_GROUP
- See Also:
- Constant Field Values
-
TYPE_USER
static final String TYPE_USER
- See Also:
- Constant Field Values
-
WILDCARD
static final String WILDCARD
- See Also:
- Constant Field Values
-
-
Method Detail
-
getClient
SecurityClient getClient()
Get any client implementing theSecurityClient- Returns:
SecurityClient
-
getId
String getId()
Get id of authorizable- Returns:
- authorizableId
-
getHomePath
String getHomePath()
Get home path to authorizable- Returns:
- path to authorizable
-
getHomeUrl
String getHomeUrl()
Get home URL to authorizable- Returns:
- URL to authorizable
-
getRootPath
String getRootPath()
Get root path of the authorizable (user/group) in repository- Returns:
- root path
-
exists
boolean exists() throws org.apache.sling.testing.clients.ClientException, InterruptedExceptionCheck if the authorizable exists- Returns:
- true if the authorizable exists
- Throws:
org.apache.sling.testing.clients.ClientException- if the request failedInterruptedException- if interrupted
-
getJsonAsString
String getJsonAsString(String propsFilter, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
String representation of authorizable http://localhost:4502/home/groups/default/administrators.rw.json?props=replication,modification,memberOf, membersTotal,members,profile/*&ml=2000- Parameters:
propsFilter- properties filterexpectedStatus- list of allowed HTTP Status to be returned.- Returns:
- the string representing a json
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
getUserPropertiesJsonAsString
String getUserPropertiesJsonAsString(int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Get user properties JSON representation as string- Parameters:
expectedStatus- status to be- Returns:
- user properties JSON representation as String
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
delete
org.apache.sling.testing.clients.SlingHttpResponse delete(int... expectedStatus) throws org.apache.sling.testing.clients.ClientExceptionDeletes an authorizable.- Parameters:
expectedStatus- list of allowed HTTP Status to be returned.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
create
<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
Creates a newAuthorizable.- Type Parameters:
T- client type- Parameters:
client- any class implementing theSecurityClient.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.- Returns:
- created
Authorizable - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
getMemberOf
Map<String,Authorizable> getMemberOf() throws org.apache.sling.testing.clients.ClientException, InterruptedException
Get members authorizable is assigned to.- Returns:
- list of
Authorizable - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycleInterruptedException- to mark this method as "waiting"
-
getMembers
Map<String,Authorizable> getMembers() throws org.apache.sling.testing.clients.ClientException, InterruptedException
Get members assigned to the authorizable.- Returns:
- list of
Authorizable - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycleInterruptedException- to mark this method as "waiting"
-
isImpersonated
boolean isImpersonated() throws org.apache.sling.testing.clients.ClientExceptionCheck if authorizable is impersonated.- Returns:
- true if authorizable is impersonated.
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
getImpersonators
Map<String,Authorizable> getImpersonators() throws org.apache.sling.testing.clients.ClientException, InterruptedException
Get impersonators of the authorizable.- Returns:
- list of
Authorizable - Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycleInterruptedException- to mark this method as "waiting"
-
getProfile
com.fasterxml.jackson.databind.JsonNode getProfile() throws org.apache.sling.testing.clients.ClientExceptionGet profile attributes for authorizable.- Returns:
- JsonNode containing profile properties
- Throws:
org.apache.sling.testing.clients.ClientException- If something fails during request/response cycle
-
-