Package org.opendaylight.aaa.shiro.idm
Class DomainHandler
java.lang.Object
org.opendaylight.aaa.shiro.idm.DomainHandler
REST application used to manipulate the H2 database domains table. The REST
endpoint is
/auth/v1/domains
.
A wrapper script called idmtool
is provided to manipulate AAA
data.
- Author:
- [email protected]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
createDomain
(javax.ws.rs.core.UriInfo info, Domain domain) Creates a domain.javax.ws.rs.core.Response
createGrant
(javax.ws.rs.core.UriInfo info, String domainId, String userId, Grant grant) Creates a grant.javax.ws.rs.core.Response
deleteDomain
(javax.ws.rs.core.UriInfo info, String domainId) Deletes a domain.javax.ws.rs.core.Response
deleteGrant
(javax.ws.rs.core.UriInfo info, String domainId, String userId, String roleId) Delete a grant.javax.ws.rs.core.Response
Extracts the domain represented bydomainId
.javax.ws.rs.core.Response
Extracts all domains.javax.ws.rs.core.Response
Get the grants for a user on a domain.javax.ws.rs.core.Response
Updates a domain.
-
Constructor Details
-
DomainHandler
-
-
Method Details
-
getDomains
@GET @Produces("application/json") public javax.ws.rs.core.Response getDomains()Extracts all domains.- Returns:
- a response with all domains stored in the H2 database
-
getDomain
@GET @Path("/{id}") @Produces("application/json") public javax.ws.rs.core.Response getDomain(@PathParam("id") String domainId) Extracts the domain represented bydomainId
.- Parameters:
domainId
- the string domain (i.e., "sdn")- Returns:
- a response with the specified domain
-
createDomain
@POST @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response createDomain(@Context javax.ws.rs.core.UriInfo info, Domain domain) Creates a domain. The name attribute is required for domain creation. Enabled and description fields are optional. Optional fields default in the following manner:enabled
:false
description
: An empty string (""
).- Parameters:
info
- passed from Jerseydomain
- designated by the REST payload- Returns:
- A response stating success or failure of domain creation.
-
putDomain
@PUT @Path("/{id}") @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response putDomain(@Context javax.ws.rs.core.UriInfo info, Domain domain, @PathParam("id") String domainId) Updates a domain.- Parameters:
info
- passed from Jerseydomain
- the REST payloaddomainId
- the last part of the path, containing the specified domain id- Returns:
- A response stating success or failure of domain update.
-
deleteDomain
@DELETE @Path("/{id}") public javax.ws.rs.core.Response deleteDomain(@Context javax.ws.rs.core.UriInfo info, @PathParam("id") String domainId) Deletes a domain.- Parameters:
info
- passed from JerseydomainId
- the last part of the path, containing the specified domain id- Returns:
- A response stating success or failure of domain deletion.
-
createGrant
@POST @Path("/{did}/users/{uid}/roles") @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response createGrant(@Context javax.ws.rs.core.UriInfo info, @PathParam("did") String domainId, @PathParam("uid") String userId, Grant grant) Creates a grant. A grant defines the role a particular user is given on a particular domain. For example, by default, AAA installs a grant for the "admin" user, granting permission to act with "admin" role on the "sdn" domain.- Parameters:
info
- passed from JerseydomainId
- the domain the user is allowed to accessuserId
- the user that is allowed to access the domaingrant
- the payload containing role access controls- Returns:
- A response stating success or failure of grant creation.
-
getRoles
@GET @Path("/{did}/users/{uid}/roles") @Produces("application/json") public javax.ws.rs.core.Response getRoles(@Context javax.ws.rs.core.UriInfo info, @PathParam("did") String domainId, @PathParam("uid") String userId) Get the grants for a user on a domain.- Parameters:
info
- passed from JerseydomainId
- the domain in questionuserId
- the user in question- Returns:
- A response containing the grants for a user on a domain.
-
deleteGrant
@DELETE @Path("/{did}/users/{uid}/roles/{rid}") public javax.ws.rs.core.Response deleteGrant(@Context javax.ws.rs.core.UriInfo info, @PathParam("did") String domainId, @PathParam("uid") String userId, @PathParam("rid") String roleId) Delete a grant.- Parameters:
info
- passed from JerseydomainId
- the domain for the grantuserId
- the user for the grantroleId
- the role for the grant- Returns:
- A response stating success or failure of the grant deletion.
-