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