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 intcountDevicesByUserId(String userId)DeviceResponsecreate(DeviceDTO deviceDTO)Responsedelete(String id)ResponsedeleteByUserId(String userId)Responsedisable(String deviceId)Responseenable(String deviceId)List<DeviceDTO>getActiveDevicesByUserId(String userId)retrieve active devices that are owned by given userDeviceDTOgetById(String id)StringResponsegetDecryptedDeviceToken(String deviceId)method is used to get decrypted device token to use it for notification sending.DeviceResponsegetDeviceByToken(String id)List<DeviceDTO>getDevicesByUserId(String userId)retrieve all devices for given userStringResponsegetHashForTokenAndTransaction(String deviceId, String transactionId)Method is used to validate response from the device for authentation attempts using push notification.ResponsemakeLoginAttemptRequestOnDevice(LoginAttemptRequest request)Send a push notification to given device with login attemptResponseregister(DeviceRegistrationRequest deviceDTO)ResponseresetDeviceToken(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:DeviceDataWebServiceretrieve active devices that are owned by given user- Specified by:
getActiveDevicesByUserIdin interfaceDeviceDataWebService- Parameters:
userId- - target user id- Returns:
DeviceDTO
-
getDevicesByUserId
public List<DeviceDTO> getDevicesByUserId(String userId)
Description copied from interface:DeviceDataWebServiceretrieve all devices for given user- Specified by:
getDevicesByUserIdin interfaceDeviceDataWebService- Parameters:
userId- - user id- Returns:
- -
List
-
getById
public DeviceDTO getById(String id)
- Specified by:
getByIdin interfaceDeviceDataWebService
-
getDeviceByToken
public DeviceResponse getDeviceByToken(String id)
- Specified by:
getDeviceByTokenin interfaceDeviceDataWebService
-
delete
public Response delete(String id)
- Specified by:
deletein interfaceDeviceDataWebService
-
deleteByUserId
public Response deleteByUserId(String userId)
- Specified by:
deleteByUserIdin interfaceDeviceDataWebService
-
create
public DeviceResponse create(DeviceDTO deviceDTO)
- Specified by:
createin interfaceDeviceDataWebService
-
register
public Response register(DeviceRegistrationRequest deviceDTO)
- Specified by:
registerin interfaceDeviceDataWebService
-
enable
public Response enable(String deviceId)
- Specified by:
enablein interfaceDeviceDataWebService
-
disable
public Response disable(String deviceId)
- Specified by:
disablein interfaceDeviceDataWebService
-
resetDeviceToken
public Response resetDeviceToken(String deviceId, String newDeviceToken)
Description copied from interface:DeviceDataWebServiceusually 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:
resetDeviceTokenin interfaceDeviceDataWebService- Parameters:
deviceId- - internal OpenIAM device IdnewDeviceToken- - new token coming from the device- Returns:
- -
Responsewith statusResponseStatus.SUCCESSis reset was success andResponseStatus.FAILUREotherwise.
-
getDecryptedDeviceToken
public StringResponse getDecryptedDeviceToken(String deviceId)
Description copied from interface:DeviceDataWebServicemethod is used to get decrypted device token to use it for notification sending.- Specified by:
getDecryptedDeviceTokenin interfaceDeviceDataWebService- Parameters:
deviceId- - id of required device- Returns:
StringResponsewithResponseStatus.SUCCESSand decrypted token inBaseDataResponse.valueif successfully decrpyted orResponseStatus.FAILUREin case of some problems;
-
makeLoginAttemptRequestOnDevice
public Response makeLoginAttemptRequestOnDevice(LoginAttemptRequest request)
Description copied from interface:DeviceDataWebServiceSend a push notification to given device with login attempt- Specified by:
makeLoginAttemptRequestOnDevicein interfaceDeviceDataWebService- Parameters:
request-LoginAttemptRequest- Returns:
- success status in case everyting is OK.
-
getHashForTokenAndTransaction
public StringResponse getHashForTokenAndTransaction(String deviceId, String transactionId)
Description copied from interface:DeviceDataWebServiceMethod 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:
getHashForTokenAndTransactionin interfaceDeviceDataWebService- Parameters:
deviceId- device - id of given devicetransactionId- - current transaction id- Returns:
- hash value
-
countDevicesByUserId
public int countDevicesByUserId(String userId)
- Specified by:
countDevicesByUserIdin interfaceDeviceDataWebService
-
-