@Security public class TokenServiceSecurity extends CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams> implements TokenService
TokenServiceentityClass| Constructor and Description |
|---|
TokenServiceSecurity() |
| Modifier and Type | Method and Description |
|---|---|
void |
activatePending(java.lang.Long tokenId)
Activates an already assigned token with status
TokenStatus.PENDING_ACTIVATION.This operation can only be done by admins/brokers over tokens of managed users or member over tokens of its operators with permission to activate the corresponding TokenPrincipalTypeVO. |
void |
assign(TokenActionDTO dto,
UserLocatorVO locator)
Searches for a token with the given type and value specified in the
TokenActionDTO parameter.The token's status must be TokenStatus.UNASSIGNED orTokenStatus.PENDING_ACTIVATION but
assigned to the logged user or one of its operators.If the token is unassigned then this method assigns it to the user specified by the UserLocatorVO
parameter and change its status to TokenStatus.ACTIVE.Otherwise (the token is already adssigend and is pending by activation) it activates only. This method can be used only by members (i.e. |
SerializableInputStream |
barcode(TokenBarcodeParams params)
Returns a barcode image of the token
|
void |
block(java.lang.Long tokenId)
Blocks the given token
|
void |
cancel(java.lang.Long tokenId)
Cancels the given token
|
void |
cancelNFCToken(TokenActionDTO dto)
Cancels the given NFC token.
|
protected void |
checkCreateNew(TokenDataParams params)
Checks whether creating new entities with the given context parameters is allowed, throwing
PermissionDeniedException if not |
protected void |
customizeData(TokenData data)
Can be overridden in order to process the returned data object for the given entity
|
protected boolean |
doHasManageAccess(Token entity)
Should be implemented in order to return whether the caller is allowed to manage the given entity, for the given
operation
|
boolean |
doHasViewAccess(Token entity)
Should be implemented in order to return whether the caller is allowed to view the given entity.
|
SerializableInputStream |
exportToCSV(TokenQuery query)
Returns a CSV version of all returned tokens
|
protected CRUDServiceLocal<Token,TokenDTO,TokenData,TokenDataParams> |
getImplementation()
Should be implemented in order to return the actual implementation of the service
|
InitializeNFCTagData |
getInitializeNFCTagData()
Returns data with the token types available to initialize a blank NFC tag.
The available tokens to personalize the tag are returned too to allow initialization and personalization at the same time. |
TokensListData |
getListData(TokenPrincipalTypeVO tokenType,
UserLocatorVO locator)
Returns data for listing tokens of a given type and user
|
PersonalizeNFCTagData |
getPersonalizeNFCTagData(TokenPrincipalTypeVO tokenTypeVO,
UserLocatorVO locator)
Returns data needed to personalize a NFC tag for the specified type and user.
The PersonalizeNFCTagData.CONFIRMATION_PASSWORD_INPUT will be null if the logged user manages the given
user. |
TokenSearchData |
getSearchData(TokenPrincipalTypeVO tokenType)
Returns data for searching tokens
|
boolean |
hasPermissionToPersonalizeAtRegistration(UserGroup group,
NFCTokenPrincipalType type,
boolean asMember)
Returns true if the logged user can personalize a token for the given type and also checks the user can register
new users for the specified group.
|
InitializeNFCTagResult |
initializeNFCTag(NFCTagInitializeDTO dto)
Initializes and optionally personalize a NFC tag with the given data.
|
boolean |
isAccessible(SessionData sessionData,
Token entity)
Must be implemented in order to determine whether the given entity is accessible for the given session data.
|
protected void |
onBeforeSave(TokenDTO dto,
Token entity) |
void |
personalizeNFCTag(NFCTagPersonalizeDTO dto)
Personalizes a NFC tag for the given user.
|
ExternalNFCTagAuthenticateData |
requestForExternalAuthenticate(ExternalNFCTagAuthenticateDTO dto)
This method must be invoked to start a mutual authentication process between the server and the NFC tag (e.g.
|
void |
requestNewOTPForPersonalizeNFCTag(UserLocatorVO locator,
TokenPrincipalTypeVO tokenTypeVO,
SendMedium medium)
Generates a new OTP (removing any previous password, if any) and sends it to the user by the specified medium
using the confirmation password type set for the
BuiltInChannel.POS channel for the specified user.It has the same security controls as for TokenService.personalizeNFCTag(NFCTagPersonalizeDTO), that is
the logged user must be allowed to personalize a NFC Tag for the specified user. |
Page<TokenVO> |
search(TokenQuery query)
Searches for tokens.
|
void |
unblock(java.lang.Long tokenId)
Unblocks the given token
|
canPerformOperation, canViewHistoryLog, checkManageAccess, checkOperation, checkViewAccess, find, getConfirmationPasswordInputForRemove, getData, getDataForNew, getEntityClass, hasManageAccess, hasViewAccess, load, remove, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveEntityCheck, save, saveWithConfirmationPasswordcheckGuest, checkId, checkIds, checkInternalName, checkLoggedIn, checkManagesUser, checkRelatesToUser, checkVO, checkVOs, doInitialize, getEntityCheckRegistry, getUser, initializecanManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getAccountHandler, getAuthHandler, getBaseEntityManagerHandler, getChannelConfiguration, getConfiguration, getConversionHandler, getCustomFieldValueHandler, getEntityManagerHandler, getGroupsHandler, getLoggedBasicUser, getLoggedUser, getProducts, getProductsHandler, getReportHandler, getTranslatedName, getTranslatedValue, getUserLocatorHandler, getValidationResult, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, toDate, toDateTime, validatedelete, detach, find, flush, from, getApplicationContext, getConfigurationHandler, getDataTranslationHandler, getFormatter, getFormatter, getFormatter, getLogger, getNotificationHandler, getProfileFieldHandler, getRemoteAddress, getSessionData, getTransactionHandler, getTranslationHandler, mailContentBuilder, message, message, persist, processBatch, refresh, remove, selectFrom, subQuery, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetData, getDataForNew, load, remove, removeAll, savepublic void activatePending(java.lang.Long tokenId)
TokenServiceTokenStatus.PENDING_ACTIVATION.TokenPrincipalTypeVO.activatePending in interface TokenServicepublic void assign(TokenActionDTO dto, UserLocatorVO locator)
TokenServiceTokenActionDTO parameter.TokenStatus.UNASSIGNED orTokenStatus.PENDING_ACTIVATION but
assigned to the logged user or one of its operators.UserLocatorVO
parameter and change its status to TokenStatus.ACTIVE.TokenPrincipalTypeVO.assign in interface TokenService#activatePending(Long)} for admins/brokers.public SerializableInputStream barcode(TokenBarcodeParams params) throws FrameworkException
TokenServicebarcode in interface TokenServiceFrameworkExceptionpublic void block(java.lang.Long tokenId)
TokenServiceblock in interface TokenServicepublic void cancel(java.lang.Long tokenId)
TokenServicecancel in interface TokenServicepublic void cancelNFCToken(TokenActionDTO dto)
TokenServiceTokenType.NFC_TAG.TokenType.NFC_DEVICE only the logged user can cancel its own token.cancelNFCToken in interface TokenServicepublic boolean doHasViewAccess(Token entity)
CRUDServiceSecuritydoHasViewAccess in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>public SerializableInputStream exportToCSV(TokenQuery query) throws FrameworkException
TokenServiceexportToCSV in interface TokenServiceFrameworkExceptionpublic InitializeNFCTagData getInitializeNFCTagData() throws FrameworkException
TokenServicegetInitializeNFCTagData in interface TokenServiceFrameworkExceptionTokenService.initializeNFCTag(NFCTagInitializeDTO)public TokensListData getListData(TokenPrincipalTypeVO tokenType, UserLocatorVO locator) throws FrameworkException
TokenServicegetListData in interface TokenServiceFrameworkExceptionpublic PersonalizeNFCTagData getPersonalizeNFCTagData(TokenPrincipalTypeVO tokenTypeVO, UserLocatorVO locator) throws FrameworkException
TokenServicePersonalizeNFCTagData.CONFIRMATION_PASSWORD_INPUT will be null if the logged user manages the given
user. The PersonalizeNFCTagData.TOKEN_TYPE is the token principal type the tag was initialized for.getPersonalizeNFCTagData in interface TokenServiceFrameworkExceptionpublic TokenSearchData getSearchData(TokenPrincipalTypeVO tokenType) throws FrameworkException
TokenServicegetSearchData in interface TokenServiceFrameworkExceptionpublic boolean hasPermissionToPersonalizeAtRegistration(UserGroup group, NFCTokenPrincipalType type, boolean asMember)
asMember - Only used if the logged user is a broker.public InitializeNFCTagResult initializeNFCTag(NFCTagInitializeDTO dto) throws FrameworkException
TokenServiceTokenActionWithUserDTO.getUser() is not null then the token will be personalized for that user too.
Returns the private keys (PICC Master Key (i.e. PMK), Application Master Key (i.e. AMK) and Operational key) to
be stored into the tag.initializeNFCTag in interface TokenServiceFrameworkExceptionpublic boolean isAccessible(SessionData sessionData, Token entity)
CRUDServiceSecurityCRUDServiceSecurity.hasViewAccess(BaseEntity). If the only condition for an entity is
CRUDServiceSecurity.hasViewAccess(BaseEntity), this method
should return false.isAccessible in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>public void personalizeNFCTag(NFCTagPersonalizeDTO dto) throws FrameworkException
TokenServiceTokenService.requestForExternalAuthenticate(ExternalNFCTagAuthenticateDTO))NFCTagPersonalizeDTO.CYCLOS_CHALLENGE is the encrypted (hexadecimal string) challenge
generated by the server (returned in the previous external authenticate) used to ensure the tag presence
(internal authenticate)personalizeNFCTag in interface TokenServiceFrameworkExceptionTokenService.requestForExternalAuthenticate(ExternalNFCTagAuthenticateDTO)public ExternalNFCTagAuthenticateData requestForExternalAuthenticate(ExternalNFCTagAuthenticateDTO dto) throws FrameworkException
TokenServicerequestForExternalAuthenticate in interface TokenServicedto - contains the token type id (required), the token value (optional) and an encrypted challenge
(required) generated by the tag in hexadecimal notation.
If the token value is null then means the authentication process will be using the PICC Master Key (PMK).ExternalNFCTagAuthenticateData.CYCLOS_CHALLENGE: encrypted data (hexadecimal string) containing both:
a new challenge generated by the server (used to validate the identity
of the NFC tag, internal authenticate) and the original challenge generated by the tag processed according to the
tag's
authentication process. The (processed) original tag challenge will be used by the NFC tag to complete the server
identity validation (external authenticate).ExternalNFCTagAuthenticateData.SESSION_KEY: A session key needed by the tag to allow send enciphered
data to be written into the NFC tagFrameworkExceptionpublic void requestNewOTPForPersonalizeNFCTag(UserLocatorVO locator, TokenPrincipalTypeVO tokenTypeVO, SendMedium medium) throws FrameworkException, SmsSendingException
TokenServiceBuiltInChannel.POS channel for the specified user.TokenService.personalizeNFCTag(NFCTagPersonalizeDTO), that is
the logged user must be allowed to personalize a NFC Tag for the specified user.requestNewOTPForPersonalizeNFCTag in interface TokenServicetokenTypeVO - the principal type used to personalize the cardmedium - the medium used to send the OTP.SmsSendingException - only if medium is SendMedium.SMS and the OTP could not be sent to any
enabled for sms phone.FrameworkExceptionpublic Page<TokenVO> search(TokenQuery query) throws FrameworkException, QueryParseException
TokenServicesearch in interface TokenServiceFrameworkExceptionQueryParseExceptionpublic void unblock(java.lang.Long tokenId)
TokenServiceunblock in interface TokenServiceprotected void checkCreateNew(TokenDataParams params)
CRUDServiceSecurityPermissionDeniedException if notcheckCreateNew in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>protected void customizeData(TokenData data)
CRUDServiceSecuritycustomizeData in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>protected boolean doHasManageAccess(Token entity)
CRUDServiceSecuritydoHasManageAccess in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>protected CRUDServiceLocal<Token,TokenDTO,TokenData,TokenDataParams> getImplementation()
CRUDServiceSecuritygetImplementation in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>protected void onBeforeSave(TokenDTO dto, Token entity)
onBeforeSave in class CRUDServiceSecurity<TokenDTO,Token,TokenData,TokenDataParams>