@Requirement(reqId="DOI_INTER_040", reqName="Interface avec la base de donn\u00e9es de gestion des tokens") public class TokenResource extends AbstractResource
| Modifier and Type | Field and Description |
|---|---|
static String |
AMOUNT_OF_TIME_PARAMETER
Amount of time for which the token is not expirated.
|
static String |
IDENTIFIER_PARAMETER
User ID of the operator that creates the token.
|
private org.apache.logging.log4j.Logger |
LOG
Logger.
|
static String |
PROJECT_ID_PARAMETER
Token for a specific project.
|
private AbstractTokenDBHelper |
tokenDB
The token database.
|
private String |
tokenParam
Token parameter catched from the URL.
|
static String |
UNIT_OF_TIME_PARAMETER
Unit of time used to define the expiration time of the token.
|
| Constructor and Description |
|---|
TokenResource() |
| Modifier and Type | Method and Description |
|---|---|
String |
createToken(org.restlet.data.Form infoForm)
Creates and stores a token.
|
void |
deleteToken()
Deletes token.
|
protected void |
describeGet(org.restlet.ext.wadl.MethodInfo info)
Describes GET method.
|
protected void |
describePost(org.restlet.ext.wadl.MethodInfo info)
Describes POST method.
|
protected void |
doInit()
Set-up method that can be overridden in order to initialize the state of
the resource
|
org.restlet.representation.Representation |
getTokenInformation()
Returns the information from the token encoded as JSon format.
|
private org.restlet.ext.wadl.RepresentationInfo |
jsonRepresentation()
projects representation
|
private void |
sendTokenToUser(String userAdmin,
String userID,
String token,
int amount,
int timeUnit)
Sends the token to the user when the administrator creates a token for
theuser
|
addRequestDocToMethod, addRequestDocToMethod, addRequestDocToMethod, addResponseDocToMethod, createQueryParamDoc, createQueryRepresentationDoc, createResponseDoc, createResponseDoc, createResponseDoc, htmlRepresentation, isObjectExist, isObjectNotExist, isValueExist, isValueNotExist, stringRepresentationcanDescribe, createHtmlRepresentation, createWadlRepresentation, describe, describe, describe, describe, describe, describe, describe, describe, describeDelete, describeMethod, describeMethod, describeOptions, describeParameters, describePatch, describePut, getDescription, getName, getParameter, getParameters, getPreferredWadlVariant, getResourcePath, getResourcesBase, getWadlVariants, isAutoDescribing, options, setAutoDescribing, setDescription, setNameabort, commit, delete, delete, describeVariants, doCatch, doConditionalHandle, doError, doHandle, doHandle, doNegotiatedHandle, get, get, getAttribute, getInfo, getInfo, getOnSent, getPreferredVariant, getRole, getVariants, getVariants, handle, hasAnnotations, head, head, isAnnotated, isAutoCommitting, isCommitted, isConditional, isExisting, isInRole, isNegotiated, options, patch, patch, post, post, put, put, redirectPermanent, redirectPermanent, redirectSeeOther, redirectSeeOther, redirectTemporary, redirectTemporary, setAllowedMethods, setAnnotated, setAttribute, setAutoCommitting, setChallengeRequests, setCommitted, setConditional, setCookieSettings, setDimensions, setExisting, setLocationRef, setLocationRef, setNegotiated, setOnSent, setProxyChallengeRequests, setServerInfo, setStatus, setStatus, setStatus, setStatus, updateAllowedMethods, updateDimensionsdoError, doRelease, getAllowedMethods, getApplication, getChallengeRequests, getChallengeResponse, getClientInfo, getConditions, getConnegService, getContext, getConverterService, getCookies, getCookieSettings, getDimensions, getHostRef, getLocationRef, getLogger, getMatrix, getMatrixValue, getMaxForwards, getMetadataService, getMethod, getOriginalRef, getProtocol, getProxyChallengeRequests, getProxyChallengeResponse, getQuery, getQueryValue, getRanges, getReference, getReferrerRef, getRequest, getRequestAttributes, getRequestCacheDirectives, getRequestEntity, getResponse, getResponseAttributes, getResponseCacheDirectives, getResponseEntity, getRootRef, getServerInfo, getStatus, getStatusService, init, isConfidential, isLoggable, release, setApplication, setQueryValue, setRequest, setResponse, toBoolean, toByte, toDouble, toFloat, toInteger, toLong, toObject, toRepresentation, toRepresentation, toRepresentation, toShort, toStringpublic static final String IDENTIFIER_PARAMETER
public static final String PROJECT_ID_PARAMETER
public static final String UNIT_OF_TIME_PARAMETER
public static final String AMOUNT_OF_TIME_PARAMETER
private volatile String tokenParam
private volatile AbstractTokenDBHelper tokenDB
private volatile org.apache.logging.log4j.Logger LOG
protected void doInit()
throws org.restlet.resource.ResourceException
doInit in class AbstractResourceorg.restlet.resource.ResourceException - - if a problem happens@Requirement(reqId="DOI_SRV_150", reqName="Cr\u00e9ation d\'un token") @Post public String createToken(org.restlet.data.Form infoForm)
TokenSecurity.generate(java.lang.String, int, fr.cnes.doi.security.TokenSecurity.TimeUnit, int)token databaseinfoForm - submitted information when requesting the token creationprivate void sendTokenToUser(String userAdmin, String userID, String token, int amount, int timeUnit)
userAdmin - User administrationuserID - user to send the messagetoken - created token for userIDamount - timetimeUnit - time unit@Requirement(reqId="DOI_SRV_180", reqName="Information sur le token") @Get public org.restlet.representation.Representation getTokenInformation()
@Requirement(reqId="DOI_INTER_040", reqName="Interface avec la base de donn\u00e9es de gestion des tokens") @Delete public void deleteToken()
@Requirement(reqId="DOI_DOC_010", reqName="Documentation des interfaces") private org.restlet.ext.wadl.RepresentationInfo jsonRepresentation()
@Requirement(reqId="DOI_DOC_010", reqName="Documentation des interfaces") protected void describeGet(org.restlet.ext.wadl.MethodInfo info)
describeGet in class org.restlet.ext.wadl.WadlServerResourceinfo - method info@Requirement(reqId="DOI_DOC_010", reqName="Documentation des interfaces") protected void describePost(org.restlet.ext.wadl.MethodInfo info)
describePost in class org.restlet.ext.wadl.WadlServerResourceinfo - method infoCopyright © 2017–2020 CNES. All rights reserved.