FRAOathMechanism.h revision 094b0368ec64814f07f74f090192a2fe81c8d0b7
6443N/A/*
6443N/A * The contents of this file are subject to the terms of the Common Development and
6443N/A * Distribution License (the License). You may not use this file except in compliance with the
6443N/A * License.
6443N/A *
6443N/A * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
6443N/A * specific language governing permission and limitations under the License.
6443N/A *
6443N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include
6443N/A * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
6443N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying
6443N/A * information: "Portions copyright [year] [name of copyright owner]".
6443N/A *
6443N/A * Copyright 2016 ForgeRock AS.
6443N/A *
6443N/A * Portions Copyright 2014 Nathaniel McCallum, Red Hat
6443N/A */
6443N/A
6443N/A#include "FRAIdentity.h"
6443N/A#include "FRAMechanism.h"
6443N/A#include "FRAOathCode.h"
6443N/A
6443N/A/*!
6443N/A * An OATH authentication mechanism capable of generating HMAC- and Time-based One-Time Passwords.
6443N/A */
6443N/A@interface FRAOathMechanism : NSObject <FRAMechanism>
6443N/A
6443N/A/*!
6443N/A * The storage ID of this OATH mechanism.
6443N/A */
6443N/A@property (nonatomic) NSInteger uid;
6443N/A/*!
6443N/A * The version number of this OATH mechanism.
6443N/A */
6443N/A@property (nonatomic, readonly) NSInteger version;
6443N/A/*!
6443N/A * The identity to which this OATH mechanism is registered.
6443N/A */
6443N/A@property (nonatomic, readonly) FRAIdentity* owner;
6443N/A/*!
6443N/A * The type of this OATH mechanism (totp or hotp).
6443N/A */
6443N/A@property (nonatomic, readonly) NSString* type;
6443N/A/*!
6443N/A * The length of the OATH code generated by this mechanism. Always 6 or 8; defaults to 6.
6443N/A */
6443N/A@property (nonatomic, readonly) NSUInteger digits;
6443N/A/*!
6443N/A * The current login code for this OATH mechanism.
6443N/A */
6443N/A@property (nonatomic, readonly) FRAOathCode* code;
6443N/A
6443N/A/*!
6443N/A * Initializer which parses an OATH URL to extract all configuration detail.
6443N/A *
6443N/A * Extracted parameters include:
6443N/A * - Token type (HOTP, TOTP)
6443N/A * - Issuer
6443N/A * - Account Name
6443N/A * - Secret Key
6443N/A * - Algorithm (SHA1, MD5 etc)
6443N/A * - Counter
6443N/A *
6443N/A * @param url is the entire URL to parse.
6443N/A * @return instantiated instance or nil if a problem occurred.
6443N/A */
6443N/A- (instancetype)initWithURL:(NSURL*)url;
6443N/A/*!
6443N/A * Initializer which parses an OATH URL String to extract all configuration detail.
6443N/A *
6443N/A * Extracted parameters include:
6443N/A * - Token type (HOTP, TOTP)
6443N/A * - Issuer
6443N/A * - Account Name
6443N/A * - Secret Key
6443N/A * - Algorithm (SHA1, MD5 etc)
6443N/A * - Counter
6443N/A *
6443N/A * @param url is the entire URL to parse.
6443N/A * @return instantiated instance or nil if a problem occurred.
6443N/A */
6443N/A- (instancetype)initWithString:(NSString*)string;
6443N/A/*!
6443N/A * Generates the next code for this OATH mechanism.
6443N/A */
6443N/A- (void)generateNextCode;
6443N/A
6443N/A@end
6443N/A