Interface Authorizable
- All Known Implementing Classes:
AbstractAuthorizable,Group,User
public interface Authorizable
Interface which defines an authorizable: user / group
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final StringJSON propertiesstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringParameter marking the request being used for creating a new group.static final StringParameter marking the request being used for creating a new user.static final StringParameter indicating that the corresponding authorizable should be removed.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringJSON Schema from authorizable (minimum)static final StringSelector for AuthorizableServletstatic final StringSelector for UserPropertiesstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescription<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 existsGet any client implementing theSecurityClientGet home path to authorizableGet home URL to authorizablegetId()Get id of authorizableGet impersonators of the authorizable.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=2000Get members authorizable is assigned to.Get members assigned to the authorizable.com.fasterxml.jackson.databind.JsonNodeGet profile attributes for authorizable.Get root path of the authorizable (user/group) in repositorygetUserPropertiesJsonAsString(int... expectedStatus) Get user properties JSON representation as stringbooleanCheck if authorizable is impersonated.
-
Field Details
-
SCHEMA_AUTHORIZABLE
JSON Schema from authorizable (minimum)- See Also:
-
SELECTOR
Selector for AuthorizableServlet- See Also:
-
SELECTOR_USERPROPERTIES
Selector for UserProperties- See Also:
-
PARAM_DELETE
Parameter indicating that the corresponding authorizable should be removed.- See Also:
-
PARAM_CREATE_USER
Parameter marking the request being used for creating a new user.- See Also:
-
PARAM_CREATE_GROUP
Parameter marking the request being used for creating a new group.- See Also:
-
ACTION_CREATE_USER
static final int ACTION_CREATE_USER- See Also:
-
ACTION_CREATE_GROUP
static final int ACTION_CREATE_GROUP- See Also:
-
PARAM_AUTHORIZABLE_ID
- See Also:
-
PARAM_PASSWORD
- See Also:
-
PARAM_INTERMEDIATE_PATH
- See Also:
-
PARAM_ADD_IMPERSONATORS
- See Also:
-
PARAM_REMOVE_IMPERSONATORS
- See Also:
-
PARAM_ADD_MEMBERS
- See Also:
-
PARAM_REMOVE_MEMBERS
- See Also:
-
AUTHORIZABLE_ID
JSON properties- See Also:
-
HOME
- See Also:
-
IS_IMPERSONATED
- See Also:
-
MEMBERS
- See Also:
-
MEMBER_OF
- See Also:
-
PROFILE
- See Also:
-
IMPERSONATORS
- See Also:
-
TYPE
- See Also:
-
TYPE_GROUP
- See Also:
-
TYPE_USER
- See Also:
-
WILDCARD
- See Also:
-
-
Method Details
-
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
Check 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.ClientException Deletes 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, InterruptedExceptionGet 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, InterruptedExceptionGet 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, InterruptedExceptionGet 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
-