Inherits from NSObject
Declared in KGLoginHandler.h

Overview

  • A login handler is responsible for obtaining credentials from an arbitrary source. *
  • Login Handlers can be associated with one or more KGChallengeHandler
  • objects, to ensure that when a Challenge Handler requires credentials for a KGChallengeResponse,
  • the work is delegated to a KGLoginHandler. *
  • At client configuration time, a KGLoginHandler can be associated with a KGChallengeHandler as follows:

    `MyLoginHandler* loginHandler = [[MyLoginHandler alloc] init];
     KGBasicChallengeHandler* challengeHandler = [KGBasicChallengeHandler create];
     [challengeHandler setLoginHandler:loginHandler];
    
     @interface MyLoginHandler : KGLoginHandler
     @end
    
     @implementation MyLoginHandler {
         int counter;
     }
    
     - (id)init {
         NSLog(@"[MyLoginHandler init]");
         self = [super init];
         if (self) {
             counter = 0;
         }
         return self;
     }
    
     -(NSURLCredential*) credentials {
         NSLog(@"providing incorrect credential");
         if (counter++ < 3) {
             return [[NSURLCredential alloc] initWithUser:@"joe" password:@"NOT - welcome"
                    persistence:NSURLCredentialPersistenceNone];
         }
        else {
            counter = 0;
            return nil;
         }
     }
     @end`
    

Tasks

  • – credentials

    Gets the password authentication credentials from an arbitrary source.

Instance Methods

credentials

Gets the password authentication credentials from an arbitrary source.

- (NSURLCredential *)credentials

Return Value

the password authentication obtained.

Declared In

KGLoginHandler.h