6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell/*
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * The contents of this file are subject to the terms of the Common Development and
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * Distribution License (the License). You may not use this file except in compliance with the
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * License.
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell *
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * specific language governing permission and limitations under the License.
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell *
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * When distributing Covered Software, include this CDDL Header Notice in each file and include
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * Header, with the fields enclosed by brackets [] replaced by your own identifying
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * information: "Portions copyright [year] [name of copyright owner]".
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell *
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * Copyright 2016 ForgeRock AS.
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell */
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell@class FRAIdentity;
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell#import "FRAMechanism.h"
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell/*!
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell * An authentication mechanism capable of authenticating by responding to a push notification.
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell */
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell@interface FRAPushMechanism : FRAMechanism
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott/*!
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Secret key for Push Notifications
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott */
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott@property (nonatomic, readonly) NSString *secret;
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott/*!
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Authentication Endpoint to contact for Push Notifications
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott */
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott@property (nonatomic, readonly) NSString *authEndpoint;
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott/*!
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * The Device ID that this device is registered under.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott */
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott@property (nonatomic, readonly) NSString* mechanismUID;
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark -
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark Lifecyle
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Init Push Mechanism.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param database The database to which this mechanism can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @return The initialized mechanism or nil if initialization failed.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell/*!
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell * Create an instance of PushMechanism
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell *
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param database Required to allow mechnaism to persist changes.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param authEndPoint The authentication endpoint URI used for signalling to the server.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param secret Shared secret key required for authentication.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param version the version of the database object.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param mechanismIdentifier uid for the mechanism.
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell *
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell * @return The initialized mechanism or nil if initialization failed.
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel authEndpoint:(NSString *)authEndPoint secret:(NSString *)secret version:(NSInteger)version mechanismIdentifier:(NSString *)mechanismIdentifier;
465ea459a87d4605e145d8f45b6a9c104b696e3bCraig McDonnell
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings/*!
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Create an instance of PushMechanism
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings *
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param database Required to allow mechnaism to persist changes.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param authEndPoint The authentication endpoint URI used for signalling to the server.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param secret Shared secret key required for authentication.
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings *
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings * @return The initialized mechanism or nil if initialization failed.
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel authEndpoint:(NSString *)authEndPoint secret:(NSString *)secret;
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Allocate and init Push Mechanism.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param database The database to which this mechanism can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @return The initialized mechanism or nil if initialization failed.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni+ (instancetype)pushMechanismWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings/*!
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings * Allocate and init Push Mechanism.
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings *
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings * @param database The database to which this mechanism can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings *
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings * @return The initialized mechanism or nil if initialization failed.
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni+ (instancetype)pushMechanismWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel authEndpoint:(NSString *)authEndPoint secret:(NSString *)secret;
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott/*!
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * Allocate and init Push Mechanism with version information included.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott *
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @param database The database to which this mechanism can be persisted.
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni * @param identityModel The identity model which contains the list of identities.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott *
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott * @return The initialized mechanism or nil if initialization failed.
721bb987c406979bcfe705fa1ca8d54497d40fcbRobert Wapshott */
f877f6ca2428244a6d0954a1dbef471577b32c60Diego Colantoni+ (instancetype)pushMechanismWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel authEndpoint:(NSString *)authEndPoint secret:(NSString *)secret version:(NSInteger)version mechanismIdentifier:(NSString *)mechanismIdentifier;
9ebd9a731316dfd624ce3bcc4ea6519d10899936Ken Stubbings
6c1420dd55f69d09f39dd213ee6c97ba901b8d92Craig McDonnell@end