FRAMechanismFactory.h revision 415243fbc81341293a852ff6aa14e9608d08685c
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott/*
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * The contents of this file are subject to the terms of the Common Development and
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Distribution License (the License). You may not use this file except in compliance with the
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * License.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * specific language governing permission and limitations under the License.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * When distributing Covered Software, include this CDDL Header Notice in each file and include
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Header, with the fields enclosed by brackets [] replaced by your own identifying
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * information: "Portions copyright [year] [name of copyright owner]".
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Copyright 2016 ForgeRock AS.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott */
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott@class FRAIdentity;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell@class FRAIdentityModel;
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott@class FRAMechanism;
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott/*!
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * This Authenticator Application makes use of the existing OATH
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * URL scheme for encoding Identity and Mechanism information.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * This is defined in detail here:
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * https://github.com/google/google-authenticator/wiki/Key-Uri-Format
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * This factory will also be able to parse a similar URL scheme
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Push Authentication when it is supported by this Application.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Note: Only responsible for generating the instances of Identity and
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Mechanism. Will not be responsible for database persistence.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott */
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott@interface FRAMechanismFactory : NSObject
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * The identity model.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell */ // TODO: Make identityModel a private property
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell@property (nonatomic, strong, readonly) FRAIdentityModel *identityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark -
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark Lifecycle
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell/*!
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * Init method.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param database The database to which this object can be persisted.
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @return The initialized object or nil if initialization failed.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott */
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell- (instancetype)initWithDatabase:(FRAIdentityDatabase *)database identityModel:(FRAIdentityModel *)identityModel;
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark -
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell#pragma mark Factory Functions
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott/*!
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Given a URL, convert this into a FRAMechanism, complete with associated Identity.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott *
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell * @param url The URL to parse, non-nil.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * @return non nil FRAMechanism initialsed with the values present in the URL.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott */
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell- (FRAMechanism*)parseFromURL:(NSURL*)url;
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott/*!
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott * Convenience function which will call parseFromURL.
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott */
415243fbc81341293a852ff6aa14e9608d08685cCraig McDonnell- (FRAMechanism*)parseFromString:(NSString*)string;
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott
91f0e3cb60de3eba8cbb70c7e36cc0df22d71f5bRobert Wapshott@end