80 lines
4.2 KiB
Java
80 lines
4.2 KiB
Java
package com.inteligr8.alfresco.acs.api;
|
|
|
|
import com.inteligr8.alfresco.acs.model.Error;
|
|
import com.inteligr8.alfresco.acs.model.TicketBody;
|
|
import com.inteligr8.alfresco.acs.model.TicketEntry;
|
|
import com.inteligr8.alfresco.acs.model.ValidTicketEntry;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiResponse;
|
|
import io.swagger.annotations.ApiResponses;
|
|
import javax.ws.rs.*;
|
|
|
|
/**
|
|
* Alfresco Content Services REST API
|
|
*
|
|
* <p>**Authentication API** Provides access to the authentication features of Alfresco Content Services.
|
|
*
|
|
*/
|
|
@Path("/api/-default-/public/authentication/versions/1")
|
|
@Api(value = "/api/-default-/public/authentication/versions/1", description = "")
|
|
public interface AuthenticationApi {
|
|
|
|
/**
|
|
* Create ticket (login)
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Logs in and returns the new authentication ticket. The userId and password properties are mandatory in the request body. For example: ```JSON { \"userId\": \"jbloggs\", \"password\": \"password\" } ``` To use the ticket in future requests you should pass it in the request header. For example using Javascript: ```Javascript request.setRequestHeader (\"Authorization\", \"Basic \" + btoa(ticket)); ```
|
|
*
|
|
*/
|
|
@POST
|
|
@Path("/tickets")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Create ticket (login)", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 201, message = "Successful response", response = TicketEntry.class),
|
|
@ApiResponse(code = 400, message = "**userId** or **password** is not provided "),
|
|
@ApiResponse(code = 403, message = "Login failed"),
|
|
@ApiResponse(code = 501, message = "SAML is enabled and enforced"),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public TicketEntry createTicket(TicketBody ticketBodyCreate);
|
|
|
|
/**
|
|
* Delete ticket (logout)
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Deletes logged in ticket (logout).
|
|
*
|
|
*/
|
|
@DELETE
|
|
@Path("/tickets/-me-")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Delete ticket (logout)", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 204, message = "Successful response"),
|
|
@ApiResponse(code = 400, message = "URL path does not include **-me-** or the ticket is not provided by the Authorization header"),
|
|
@ApiResponse(code = 404, message = "Status of the user has changed (for example, the user is locked or the account is disabled) or the ticket has expired"),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public void deleteTicket();
|
|
|
|
/**
|
|
* Validate ticket
|
|
*
|
|
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Validates the specified ticket (derived from Authorization header) is still valid. For example, you can pass the Authorization request header using Javascript: ```Javascript request.setRequestHeader (\"Authorization\", \"Basic \" + btoa(ticket)); ```
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/tickets/-me-")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Validate ticket", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = ValidTicketEntry.class),
|
|
@ApiResponse(code = 400, message = "URL path does not include **-me-** or the ticket is not provided by the Authorization header"),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 404, message = "The request is authorized correctly but the status of the user (of the supplied ticket) has changed (for example, the user is locked or the account is disabled) or the ticket has expired"),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public ValidTicketEntry validateTicket();
|
|
}
|
|
|