Package org.openiam.srvc.device
Class DeviceDataWebServiceImpl
- java.lang.Object
-
- org.openiam.srvc.AbstractApiService
-
- org.openiam.srvc.device.DeviceDataWebServiceImpl
-
- All Implemented Interfaces:
DeviceDataWebService
@Service("deviceService") public class DeviceDataWebServiceImpl extends AbstractApiService implements DeviceDataWebService
-
-
Field Summary
-
Fields inherited from class org.openiam.srvc.AbstractApiService
applicationContext, log, rabbitMQSender
-
-
Constructor Summary
Constructors Constructor Description DeviceDataWebServiceImpl(DeviceServiceQueue rabbitMqQueue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countDevicesByUserId(String userId)
DeviceResponse
create(DeviceDTO deviceDTO)
Response
delete(String id)
Response
deleteByUserId(String userId)
Response
disable(String deviceId)
Response
enable(String deviceId)
List<DeviceDTO>
getActiveDevicesByUserId(String userId)
retrieve active devices that are owned by given userDeviceDTO
getById(String id)
StringResponse
getDecryptedDeviceToken(String deviceId)
method is used to get decrypted device token to use it for notification sending.DeviceResponse
getDeviceByToken(String id)
List<DeviceDTO>
getDevicesByUserId(String userId)
retrieve all devices for given userStringResponse
getHashForTokenAndTransaction(String deviceId, String transactionId)
Method is used to validate response from the device for authentation attempts using push notification.Response
makeLoginAttemptRequestOnDevice(LoginAttemptRequest request)
Send a push notification to given device with login attemptResponse
register(DeviceRegistrationRequest deviceDTO)
Response
resetDeviceToken(String deviceId, String newDeviceToken)
usually device token is permanent and alive for application installation on device, but sometime it could be renew -The app deletes Instance ID -The app is restored on a new device -The user uninstalls/reinstall the app -The user clears app data.-
Methods inherited from class org.openiam.srvc.AbstractApiService
broadcast, crudRequest, getBooleanValue, getIntValue, getIntValue, getRabbitMqQueue, getResponse, getResponse, getValue, getValue, getValueList, getValueList, idRequest, manageApiRequest, manageApiRequest, manageCrudApiRequest, manageCrudApiRequest, manageCrudApiRequest, manageCrudApiRequest, membershipRequestProcessing, membershipRequestProcessing, publish, publish, sendAsync, sendAsync
-
-
-
-
Constructor Detail
-
DeviceDataWebServiceImpl
public DeviceDataWebServiceImpl(DeviceServiceQueue rabbitMqQueue)
-
-
Method Detail
-
getActiveDevicesByUserId
public List<DeviceDTO> getActiveDevicesByUserId(String userId)
Description copied from interface:DeviceDataWebService
retrieve active devices that are owned by given user- Specified by:
getActiveDevicesByUserId
in interfaceDeviceDataWebService
- Parameters:
userId
- - target user id- Returns:
DeviceDTO
-
getDevicesByUserId
public List<DeviceDTO> getDevicesByUserId(String userId)
Description copied from interface:DeviceDataWebService
retrieve all devices for given user- Specified by:
getDevicesByUserId
in interfaceDeviceDataWebService
- Parameters:
userId
- - user id- Returns:
- -
List
-
getById
public DeviceDTO getById(String id)
- Specified by:
getById
in interfaceDeviceDataWebService
-
getDeviceByToken
public DeviceResponse getDeviceByToken(String id)
- Specified by:
getDeviceByToken
in interfaceDeviceDataWebService
-
delete
public Response delete(String id)
- Specified by:
delete
in interfaceDeviceDataWebService
-
deleteByUserId
public Response deleteByUserId(String userId)
- Specified by:
deleteByUserId
in interfaceDeviceDataWebService
-
create
public DeviceResponse create(DeviceDTO deviceDTO)
- Specified by:
create
in interfaceDeviceDataWebService
-
register
public Response register(DeviceRegistrationRequest deviceDTO)
- Specified by:
register
in interfaceDeviceDataWebService
-
enable
public Response enable(String deviceId)
- Specified by:
enable
in interfaceDeviceDataWebService
-
disable
public Response disable(String deviceId)
- Specified by:
disable
in interfaceDeviceDataWebService
-
resetDeviceToken
public Response resetDeviceToken(String deviceId, String newDeviceToken)
Description copied from interface:DeviceDataWebService
usually device token is permanent and alive for application installation on device, but sometime it could be renew -The app deletes Instance ID -The app is restored on a new device -The user uninstalls/reinstall the app -The user clears app data.- Specified by:
resetDeviceToken
in interfaceDeviceDataWebService
- Parameters:
deviceId
- - internal OpenIAM device IdnewDeviceToken
- - new token coming from the device- Returns:
- -
Response
with statusResponseStatus.SUCCESS
is reset was success andResponseStatus.FAILURE
otherwise.
-
getDecryptedDeviceToken
public StringResponse getDecryptedDeviceToken(String deviceId)
Description copied from interface:DeviceDataWebService
method is used to get decrypted device token to use it for notification sending.- Specified by:
getDecryptedDeviceToken
in interfaceDeviceDataWebService
- Parameters:
deviceId
- - id of required device- Returns:
StringResponse
withResponseStatus.SUCCESS
and decrypted token inBaseDataResponse.value
if successfully decrpyted orResponseStatus.FAILURE
in case of some problems;
-
makeLoginAttemptRequestOnDevice
public Response makeLoginAttemptRequestOnDevice(LoginAttemptRequest request)
Description copied from interface:DeviceDataWebService
Send a push notification to given device with login attempt- Specified by:
makeLoginAttemptRequestOnDevice
in interfaceDeviceDataWebService
- Parameters:
request
-LoginAttemptRequest
- Returns:
- success status in case everyting is OK.
-
getHashForTokenAndTransaction
public StringResponse getHashForTokenAndTransaction(String deviceId, String transactionId)
Description copied from interface:DeviceDataWebService
Method is used to validate response from the device for authentation attempts using push notification. Method use deviceToken (firebase token for android, concantinate it with transaction id and generate SHA-256 hash code), it's expected to get the same hash from the device, due to only OpenIAM db and device keep teal deviceToken value- Specified by:
getHashForTokenAndTransaction
in interfaceDeviceDataWebService
- Parameters:
deviceId
- device - id of given devicetransactionId
- - current transaction id- Returns:
- hash value
-
countDevicesByUserId
public int countDevicesByUserId(String userId)
- Specified by:
countDevicesByUserId
in interfaceDeviceDataWebService
-
-