public class SecovidManagementWs extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SecovidManagementWs.ManagementWSFault
This "wrapper" class was necessary to use a common utility between ManagementWS and ServicesWS.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
_junit
A fake variable for JUnit tests.
|
Constructor and Description |
---|
SecovidManagementWs() |
Modifier and Type | Method and Description |
---|---|
boolean |
addUser(String userId)
Adds a user.
|
SecovidSTPCreateResult |
assignStpForUser(SecovidSTPParam stpParam)
Create a 8-digit Static Time Password (STP) and assign it to the specified user.
|
static void |
checkForDataNotNull(Object obj,
String objectName)
This "wrapper" method was necessary to use a common utility between ManagementWS and ServicesWS.
|
SoftTokenResult |
createSoftToken(SoftTokenParam softTokenParam)
Creates a software token for a given user ID.
|
boolean |
deleteStp(String userID)
Delete a STP of defined secovid user.
|
boolean |
deleteToken(String tokenSnr)
Deletes the referenced token from the database.
|
boolean |
deregisterToken(String tokenSnr)
Unassigns a specific token to a user.
|
com.kobil.ssms.secovid.tokenexporter.SecovidTokenExporterResult |
exportSelectedTokens(byte[] certForEncryptionOfTransportKey,
List<String> tokenSnr)
Export selected tokens.
|
com.kobil.ssms.secovid.tokenexporter.SecovidTokenExporterPageResult |
exportTokens(byte[] certForEncryptionOfTransportKey,
int pageSize,
int pageNumber)
Export tokens by dividing pages.
|
String[] |
getLockReasons()
Retrieves the configured (hard coded) user lock reasons.
|
SecovidReportingInfo |
getReportingItems(SecovidReportingFilter reportingFilter,
com.kobil.ssms.kernel.logic.pagination.OrderInput orderInput,
Holder<com.kobil.ssms.kernel.presentation.b2b.Pagination> pagination)
Get reporting items from database according to the specified filter.
|
Token |
getToken(String tokenSnr)
Get token information of a specific token.
|
List<Token> |
getTokenByUserId(String userId)
Retrieve a list of
Token objects, assigned to the given userId. |
List<Token> |
getTokens(com.kobil.ssms.kernel.presentation.b2b.RangeInput rangeInput,
com.kobil.ssms.kernel.logic.pagination.OrderInput orderInput,
Holder<com.kobil.ssms.kernel.presentation.b2b.Pagination> pagination)
Get a list of all tokens in database.
|
SecovidTokenImporterResult |
importTokenFile(byte[] tokenFile,
byte[] masterTransportKeyPassword)
Import all tokens, regarding to the file content, to the SSMS database.
|
boolean |
lockToken(String tokenSnr,
String lockReason)
Locks a specific token with an according lock reason.
|
boolean |
lockUser(String userId,
String lockReason)
Locks a user.
|
boolean |
registerToken(String tokenSnr,
String userId)
Assigns a specific token to a user.
|
boolean |
removeUser(String userId)
Removes a user.
|
boolean |
resetRetryCounter(String userId)
Resets the retry counter of a user.
|
void |
setPasswordRequired(String tokenSnr,
boolean passwordRequired)
Set/unset password required for token.
|
boolean |
unlockToken(String tokenSnr)
Unlocks a specific token.
|
boolean |
unlockUser(String userId)
Unlocks a user.
|
byte[] |
userExportAsXml()
Create the XML data for use exportAsXml feature from user tab on the Secovid module
|
boolean |
verifyAndRegisterToken(String tokenSnr,
String userId,
String otp)
Deprecated.
use method
verifyAndRegisterTokenEx(String, String, String, boolean) Verifies the given OTP against the specified token, then assigns the token to the given user. |
RegisterTokenResult |
verifyAndRegisterTokenEx(String tokenSnr,
String userId,
String otp,
boolean passwordRequired)
Verifies the given OTP for given token, sets/unsets passwordRequired flag for the token and assigns the token to the given user, if token is not already assigned to user.
|
public SecovidTokenImporterResult importTokenFile(byte[] tokenFile, byte[] masterTransportKeyPassword) throws SecovidManagementWs.ManagementWSFault
tokenFile
- This file holds all token to import.masterTransportKeyPassword
- The password, with which the server can open the certificate (stored in database), which holds the
RSA-PrivateKey. This key is used to decrypt the transport key.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if an argument is null empty or invalid (File content). SecovidErrorCodes.LICENCE_EXCEEDED
if the number of imported token exceed the current licence. SecovidErrorCodes.BASE64_ENCODING_OF_THE_ENCRYPTION_CERTIFICATE_IS_CORRUPT
if the encoding of the encryption certificate is corrupt. SecovidErrorCodes.INVALID_ENCRYPTION_CERTIFICATE
if the encryption certificate is invalid. SecovidErrorCodes.ACQUIRE_TRANSPORT_KEY_FAILED
if the transport key cannot be acquired. SecovidErrorCodes.ASSIGNED_TOKEN_LIMIT_EXCEEDED
if the maximum number of tokens for a user was exceeded. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean lockToken(String tokenSnr, String lockReason) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.lockReason
- The lock reason, why this token should be locked.true
if the token was set from unlocked to lock. false
if the token was already in state locked.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if the token does not exist. SecovidErrorCodes.INVALID_ARGUMENT
if an argument is null or empty. SecovidErrorCodes.INVALID_LOCK_REASON
if the lockReason is unknown/invalid.SecovidTokenEntity#getLockReasonKey()}
public boolean unlockToken(String tokenSnr) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.true
if the state was changed from locked to unlocked. false
if the token was already in state unlocked.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if the token does not exist. SecovidErrorCodes.INVALID_ARGUMENT
if argument 'tokenSnr' is null or empty.public boolean deleteToken(String tokenSnr) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.true
if the token was successfully deleted.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if the token does not exist. SecovidErrorCodes.INVALID_ARGUMENT
if an argument is null or empty.public List<Token> getTokens(com.kobil.ssms.kernel.presentation.b2b.RangeInput rangeInput, com.kobil.ssms.kernel.logic.pagination.OrderInput orderInput, Holder<com.kobil.ssms.kernel.presentation.b2b.Pagination> pagination) throws SecovidManagementWs.ManagementWSFault
rangeInput
- - RangeInput object with information about range with "from" and "limit" values orderInput
- - OrderInput object with information about sorting field name and direction pagination
- - Holder for Pagination with information about range and order.
range is an object with "from", "limit" and "moreExist" values SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.INCOMPLETE_TOKENDATA
if one of the tokens contains inconsistent data.public Token getToken(String tokenSnr) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token to be returned.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.INVALID_ARGUMENT
if argument 'tokenSnr' is null or empty. SecovidErrorCodes.INCOMPLETE_TOKENDATA
if the token contains inconsistent data. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if the token does not exist.public boolean registerToken(String tokenSnr, String userId) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.userId
- The userId which shall be assigned.true
if the token was assigned to the user. false
if the token is already assigned to the same user.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if tokenSnr or userId is null or empty. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist any more. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if token does not exist anymore. SecovidErrorCodes.ASSIGNED_TOKEN_LIMIT_EXCEEDED
if the maximum number of tokens for a user was exceeded. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.@Deprecated public boolean verifyAndRegisterToken(String tokenSnr, String userId, String otp) throws SecovidManagementWs.ManagementWSFault
verifyAndRegisterTokenEx(String, String, String, boolean)
tokenSnr
- The serial number of the token.userId
- The userId which shall be assigned.otp
- This OTP will be verified against the specified token.true
if the token was assigned to the user. false
if the token is already assigned to the same or an other user.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if tokenSnr is not set. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.INVALID_ARGUMENT
if otp is not set. SecovidErrorCodes.INVALID_OTP
if otp has invalid format. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist any more. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if token does not exist anymore. SecovidErrorCodes.OTP_WRONG
if verification of the token failed. SecovidErrorCodes.ASSIGNED_TOKEN_LIMIT_EXCEEDED
if the maximum number of tokens for a user was exceeded. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public RegisterTokenResult verifyAndRegisterTokenEx(String tokenSnr, String userId, String otp, boolean passwordRequired) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.userId
- The userId which shall be assigned.otp
- This OTP will be verified against the specified token.passwordRequired
- The passwordRequired flag represents whether token requires password or not during OTP verification process.RegisterTokenResult
SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if tokenSnr is not set. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.INVALID_ARGUMENT
if otp is not set. SecovidErrorCodes.INVALID_OTP
if otp has invalid format. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist any more. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if token does not exist anymore. SecovidErrorCodes.OTP_WRONG
if verification of the token failed (e.g. OTP was wrong or token is locked). SecovidErrorCodes.TOKEN_ALREADY_ASSIGNED_TO_USER
if token is already assigned to a user. SecovidErrorCodes.INVALID_OTP
if 6 digit OTP for 8 digit token and vice versa. SecovidErrorCodes.USER_IS_LOCKED
if user is locked. SecovidErrorCodes.ASSIGNED_TOKEN_LIMIT_EXCEEDED
if the maximum number of tokens for a user was exceeded. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean deregisterToken(String tokenSnr) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.true
if the token was unassigned from the user. false
if the token is currently not assigned to any user.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if missing parameter token serialnumber. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if token does not exist anymore. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean addUser(String userId) throws SecovidManagementWs.ManagementWSFault
userId
- The userId which shall be added.true
if the user was added. false
if the user already exists.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean lockUser(String userId, String lockReason) throws SecovidManagementWs.ManagementWSFault
userId
- The userId which shall be locked.lockReason
- The lock reason, why this user should be locked.true
if the user was locked. false
if the user could not be locked.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist. SecovidErrorCodes.INVALID_LOCK_REASON
if the lock reason is invalid. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean unlockUser(String userId) throws SecovidManagementWs.ManagementWSFault
userId
- The userId which shall be unlocked.true
if the user was unlocked. false
if the user could not be unlocked.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean removeUser(String userId) throws SecovidManagementWs.ManagementWSFault
userId
- The userId which shall be removed.true
if the user was removed. false
if the user does not exist.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.USER_DELETION_PROHIBITED
if the user is used by other module(s). SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean resetRetryCounter(String userId) throws SecovidManagementWs.ManagementWSFault
userId
- The user for whom the retry counter shall be reset.true
if the retry counter was reset. false
if the retry counter could not be reset (e.g. because the user was locked).SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if userId is not set. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist any more. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public String[] getLockReasons() throws SecovidManagementWs.ManagementWSFault
SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public List<Token> getTokenByUserId(String userId) throws SecovidManagementWs.ManagementWSFault
Token
objects, assigned to the given userId.userId
- The given userId.Token
objects, assigned to the given userId.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_USERID
if userId is null or empty. SecovidErrorCodes.USER_DOES_NOT_EXIST
if user does not exist. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public SoftTokenResult createSoftToken(SoftTokenParam softTokenParam) throws SecovidManagementWs.ManagementWSFault
softTokenParam
- The SoftTokenParam
which contains all information that are needed to create a software token.SoftTokenResult
which contains the result of the software token generation.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.USER_DOES_NOT_EXIST
if the token shall be assigned to a user which does not exist. SecovidErrorCodes.ASSIGNED_TOKEN_LIMIT_EXCEEDED
if the token shall be assigned to a user which already has the maximum number of tokens assigned. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public SecovidSTPCreateResult assignStpForUser(SecovidSTPParam stpParam) throws SecovidManagementWs.ManagementWSFault
stpParam
- Container object, which holds the data required for assigning (see SecovidSTPParam
)SecovidSTPCreateResult
)SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if the parameter object is null. SecovidErrorCodes.INVALID_USERID
if the parameter stpParam.userId is missing. SecovidErrorCodes.INVALID_PARAMETER
if the parameters stpParam.stpUsage and stpParam.stpExpires are not set. SecovidErrorCodes.INVALID_STP_USAGE
if the parameter stpParam.stpUsage is less or equal than 0. SecovidErrorCodes.INVALID_STP_EXPIRES
if the parameter stpParam.stpExpires is before actual date. SecovidErrorCodes.NO_STP
if STP generation fails. SecovidErrorCodes.USER_DOES_NOT_EXIST
if the user does not exist any longer. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public boolean deleteStp(String userID) throws SecovidManagementWs.ManagementWSFault
userID
- - user of whom the STP shall be deletedSecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INVALID_ARGUMENT
if the userID is null or empty. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public SecovidReportingInfo getReportingItems(SecovidReportingFilter reportingFilter, com.kobil.ssms.kernel.logic.pagination.OrderInput orderInput, Holder<com.kobil.ssms.kernel.presentation.b2b.Pagination> pagination) throws SecovidManagementWs.ManagementWSFault
reportingFilter
- Provides all information for selecting reporting entries from SecOVID Reporting (see SecovidReportingFilter
).orderInput
- - OrderInput object with information about sorting field name and direction pagination
- - Holder for Pagination with information about order.
order is an object with information about sorting field name and direction. SecovidReportingInfo
object, containing the reporting items, matching to the given filter.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.MISSING_PARAMETER
if the reportingFilter is null. SecovidErrorCodes.INVALID_PARAMETER
if 'from date' and 'to date' are set and 'from date' is not chronologically before the 'to date'. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred.public void setPasswordRequired(String tokenSnr, boolean passwordRequired) throws SecovidManagementWs.ManagementWSFault
tokenSnr
- The serial number of the token.passwordRequired
- The password is required or not.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidErrorCodes.INTERNAL_SERVER_ERROR
if an internal error occurred. SecovidErrorCodes.TOKEN_DOES_NOT_EXIST
if the token does not exist. SecovidErrorCodes.INVALID_TOKENSNR
if the tokenSnr is null or empty.public com.kobil.ssms.secovid.tokenexporter.SecovidTokenExporterPageResult exportTokens(byte[] certForEncryptionOfTransportKey, int pageSize, int pageNumber) throws SecovidManagementWs.ManagementWSFault
certForEncryptionOfTransportKey
- - Certificate file ( ssms-ca.crt) .pageSize
- - The number of the tokens on each page.pageNumber
- - The index of the page to display. The first page has index = 1. (use 0 to get all tokens from DB)pageSize
and pageNumber
equal 0 -
will return all tokens without pagination.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidTokenExporterException.ErrorCode#INVALID_PAGE_VALUES
if params are invalid. SecovidTokenExporterException.ErrorCode#NO_TOKEN_TO_EXPORT
if there is not a token to export. SecovidTokenExporterException.ErrorCode#NO_VALID_TOKEN_TO_EXPORT
it there is not a valid token to exportpublic com.kobil.ssms.secovid.tokenexporter.SecovidTokenExporterResult exportSelectedTokens(byte[] certForEncryptionOfTransportKey, List<String> tokenSnr) throws SecovidManagementWs.ManagementWSFault
certForEncryptionOfTransportKey
- Certificate file ( ssms-ca.crt).tokenSnr
- The list of the token serial numbers.SecovidManagementWs.ManagementWSFault
- SecovidErrorCodes.PERMISSION_DENIED
if the permission is denied. SecovidTokenExporterException.ErrorCode#INVALID_PAGE_VALUES
if params are invalid. SecovidTokenExporterException.ErrorCode#NO_TOKEN_TO_EXPORT
if there is not a token to export. SecovidTokenExporterException.ErrorCode#NO_VALID_TOKEN_TO_EXPORT
it there is not a valid token to exportpublic byte[] userExportAsXml() throws com.kobil.ssms.kernel.logic.task.SsmsTaskException, IllegalArgumentException, com.kobil.ssms.secovid.logic.users.SecovidLogicException, SecovidManagementWs.ManagementWSFault
userExportAsXml
- hasn't any parametercom.kobil.ssms.kernel.logic.task.SsmsTaskException
IllegalArgumentException
com.kobil.ssms.secovid.logic.users.SecovidLogicException
SecovidManagementWs.ManagementWSFault
public static void checkForDataNotNull(Object obj, String objectName) throws SecovidManagementWs.ManagementWSFault
obj
- See WSUtils.checkForDataNotNull(Object, String)
objectName
- SecovidManagementWs.ManagementWSFault
Copyright © 2022 KOBIL Systems GmbH. All rights reserved.