Show TOC

Create Your Logon HandlerLocate this document in the navigation structure

Using a central class for the logon-related work is a best practice for writing code.


This example is code for a simple interface of the logon handler. The class implements MAFLogonNGDelegate and exposes an instance of MAFLogonUIViewManager.

#import <Foundation/Foundation.h>
#import "MAFLogonNGPublicAPI.h"
#import "MAFLogonManagerNG.h"
#import "MAFLogonUIViewManager.h"
#import "MAFLogonNGDelegate.h"

@interface MyLogonHandler : NSObject <MAFLogonNGDelegate>

@property (strong, nonatomic) MAFLogonUIViewManager *logonUIViewManager;
@property (strong, nonatomic) NSObject<MAFLogonNGPublicAPI> *logonManager;



This is an example implementation (MyLogonHandler.m) of the logon handler:
#import "MyLogonHandler.h"

@implementation MyLogonHandler

-(id) init{
    self = [super init];
        self.logonUIViewManager = [[[MAFLogonUIViewManager alloc] init] autorelease];
        // save reference to LogonManager for code readability
        self.logonManager = self.logonUIViewManager.logonManager;
#warning You must set your own application id. The application id can be specified in the info.plist file.
        // set up the logon delegate
        [self.logonManager setLogonDelegate:self];
    return self;

In the info.plist file of your Xcode project, add these lines:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
You must implement all MAFLogonNGDelegate methods in MyLogonHandler:
#pragma mark - MAFLogonNGDelegate impolementation

-(void) logonFinishedWithError:(NSError*)anError {
    NSLog(@"logonFinishedWithError:%@", anError);
-(void) lockSecureStoreFinishedWithError:(NSError*)anError {
    NSLog(@"lockSecureStoreFinishedWithError:%@", anError);
-(void) updateApplicationSettingsFinishedWithError:(NSError*)anError { NSLog(@"updateApplicationSettingsFinishedWithError:%@", anError);
-(void) uploadTraceFinishedWithError:(NSError *)anError {
    NSLog(@"uploadTraceFinishedWithError:%@", anError);
-(void) changeBackendPasswordFinishedWithError:(NSError*)anError {
    NSLog(@"Password change with error:%@", anError);
-(void) deleteUserFinishedWithError:(NSError*)anError {
    NSLog(@"deleteUserFinishedWithError:%@", anError);
-(void) changeSecureStorePasswordFinishedWithError:(NSError*)anError {
    NSLog(@"changeSecureStorePasswordFinishedWithError:%@", anError);
-(void) registrationInfoFinishedWithError:(NSError*)anError {
    NSLog(@"registrationInfoFinishedWithError:%@", anError);
-(void) startDemoMode {