Interface Authorizable
-
- All Known Implementing Classes:
AbstractAuthorizable
,Group
,User
public interface Authorizable
Interface which defines an authorizable: user / group
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTION_CREATE_GROUP
static int
ACTION_CREATE_USER
static String
AUTHORIZABLE_ID
JSON propertiesstatic String
HOME
static String
IMPERSONATORS
static String
IS_IMPERSONATED
static String
MEMBER_OF
static String
MEMBERS
static String
PARAM_ADD_IMPERSONATORS
static String
PARAM_ADD_MEMBERS
static String
PARAM_AUTHORIZABLE_ID
static String
PARAM_CREATE_GROUP
Parameter marking the request being used for creating a new group.static String
PARAM_CREATE_USER
Parameter marking the request being used for creating a new user.static String
PARAM_DELETE
Parameter indicating that the corresponding authorizable should be removed.static String
PARAM_INTERMEDIATE_PATH
static String
PARAM_PASSWORD
static String
PARAM_REMOVE_IMPERSONATORS
static String
PARAM_REMOVE_MEMBERS
static String
PROFILE
static String
SCHEMA_AUTHORIZABLE
JSON Schema from authorizable (minimum)static String
SELECTOR
Selector for AuthorizableServletstatic String
SELECTOR_USERPROPERTIES
Selector for UserPropertiesstatic String
TYPE
static String
TYPE_GROUP
static String
TYPE_USER
static String
WILDCARD
-
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.SlingHttpResponse
delete(int... expectedStatus)
Deletes an authorizable.boolean
exists()
Check if the authorizable existsSecurityClient
getClient()
Get any client implementing theSecurityClient
String
getHomePath()
Get home path to authorizableString
getHomeUrl()
Get home URL to authorizableString
getId()
Get id of authorizableMap<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=2000Map<String,Authorizable>
getMemberOf()
Get members authorizable is assigned to.Map<String,Authorizable>
getMembers()
Get members assigned to the authorizable.com.fasterxml.jackson.databind.JsonNode
getProfile()
Get profile attributes for authorizable.String
getRootPath()
Get root path of the authorizable (user/group) in repositoryString
getUserPropertiesJsonAsString(int... expectedStatus)
Get user properties JSON representation as stringboolean
isImpersonated()
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, InterruptedException
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, 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.ClientException
Check 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.ClientException
Get profile attributes for authorizable.- Returns:
- JsonNode containing profile properties
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
-