Class SnsMessageResource
- java.lang.Object
-
- org.forgerock.openam.services.push.sns.SnsMessageResource
-
public class SnsMessageResource extends Object
An endpoint, created and attached to the Router at the point of a newSnsHttpDelegatebeing configured to accept inbound messages from a remote device over SNS. Converts messages that come in from an SNS-specific format into a generalised one that the Push auth system and message dispatcher can use. The registration field is special, as it communicates out with Amazon's SNS to ensure that the registration is successfully completed. This endpoint will receive both authentication and registration messages. The format of these messages will be: { "jwt" : "...", // signed jwt, including all claims necessary for operation (reg or auth) "messageId" : "..." // unique identifier for this message }- See Also:
SnsHttpDelegate,PushNotificationService
-
-
Constructor Summary
Constructors Constructor Description SnsMessageResource(CTSPersistentStore coreTokenService, PushNotificationService pushNotificationService, JSONSerialisation jsonSerialisation, Debug debug, org.forgerock.json.jose.common.JwtReconstruction jwtReconstruction)Generate a new SnsMessageResource using the provided MessageDispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.forgerock.util.promise.Promise<org.forgerock.json.resource.ActionResponse,org.forgerock.json.resource.ResourceException>authenticate(org.forgerock.services.context.Context context, org.forgerock.json.resource.ActionRequest actionRequest)Forwards the provided message - so long as it has a messageId in the appropriate place - to the messageDispatcher which is responsible for informing the appropriate receiver in OpenAM of the data received in the message.org.forgerock.util.promise.Promise<org.forgerock.json.resource.ActionResponse,org.forgerock.json.resource.ResourceException>register(org.forgerock.services.context.Context context, org.forgerock.json.resource.ActionRequest actionRequest)For a registration message - determines the type of remote OS and registers the device with Amazon SNS.
-
-
-
Constructor Detail
-
SnsMessageResource
@Inject public SnsMessageResource(CTSPersistentStore coreTokenService, PushNotificationService pushNotificationService, JSONSerialisation jsonSerialisation, @Named("frPush") Debug debug, org.forgerock.json.jose.common.JwtReconstruction jwtReconstruction)
Generate a new SnsMessageResource using the provided MessageDispatcher.- Parameters:
coreTokenService- A copy of the core token services - messages are dropped on to this for use in clustered environments.pushNotificationService- Used to get the message dispatcher, usde to deliver messages received at this endpoint to their appropriate locations within OpenAM.jsonSerialisation- Used to perform the serialisation necessary for inserting tokens into the CTS.debug- For writing out debug messages.jwtReconstruction- For recreating JWTs.
-
-
Method Detail
-
authenticate
public org.forgerock.util.promise.Promise<org.forgerock.json.resource.ActionResponse,org.forgerock.json.resource.ResourceException> authenticate(org.forgerock.services.context.Context context, org.forgerock.json.resource.ActionRequest actionRequest)Forwards the provided message - so long as it has a messageId in the appropriate place - to the messageDispatcher which is responsible for informing the appropriate receiver in OpenAM of the data received in the message.- Parameters:
context- Context of this request used to retrieve the current realm location.actionRequest- The request triggering the dispatch.- Returns:
- An empty HTTP 200 if everything was okay, or an HTTP 400 if the request was malformed.
-
register
public org.forgerock.util.promise.Promise<org.forgerock.json.resource.ActionResponse,org.forgerock.json.resource.ResourceException> register(org.forgerock.services.context.Context context, org.forgerock.json.resource.ActionRequest actionRequest)For a registration message - determines the type of remote OS and registers the device with Amazon SNS. Then returns information necessary to continue registration back to the message dispatcher so the calling method can store the newly minted device and continue the authentication process.- Parameters:
context- Context of this request used to retrieve the current realm location.actionRequest- The request triggering the dispatch.- Returns:
- An empty HTTP 200 if everything was okay, or an HTTP 400 if the request was malformed.
-
-