• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
AuthScheme Interface Reference
Inheritance diagram for AuthScheme:
AuthSchemeBase NTLMScheme RFC2617Scheme BasicScheme DigestScheme

Description

This interface represents an abstract challenge-response oriented authentication scheme.

An authentication scheme should be able to support the following functions:

  • Parse and process the challenge sent by the targer server in response to request for a protected resource
  • Provide its textual designation
  • Provide its parameters, if available
  • Provide the realm this authentication scheme is applicable to, if available
  • Generate authorization string for the given set of credentials, request method and URI as specificed in the HTTP request line in response to the actual authorization challenge

Authentication schemes may ignore method name and URI parameters if they are not relevant for the given authentication mechanism

Authentication schemes may be stateful involving a series of challenge-response exchanges

Author
Oleg Kalnichevski
Adrian Sutton
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

void processChallenge (final Header header) throws MalformedChallengeException
 Processes the given challenge token. More...
 
String getSchemeName ()
 Returns textual designation of the given authentication scheme. More...
 
String getParameter (final String name)
 Returns authentication parameter with the given name, if available. More...
 
String getRealm ()
 Returns authentication realm. More...
 
boolean isConnectionBased ()
 Tests if the authentication scheme is provides authorization on a per connection basis instead of usual per request basis. More...
 
boolean isComplete ()
 Authentication process may involve a series of challenge-response exchanges. More...
 
Header authenticate (Credentials credentials, HttpRequest request) throws AuthenticationException
 Produces an authorization string for the given set of com.good.gd.apache.http.auth.Credentials. More...
 

Member Function Documentation

◆ processChallenge()

void processChallenge ( final Header  header) throws MalformedChallengeException

Some authentication schemes may involve multiple challenge-response exchanges. Such schemes must be able to maintain the state information when dealing with sequential challenges

Parameters
headerthe challenge header

Implemented in DigestScheme, BasicScheme, and AuthSchemeBase.

◆ getSchemeName()

String getSchemeName ( )
Returns
the name of the given authentication scheme

Implemented in DigestScheme, BasicScheme, and NTLMScheme.

◆ getParameter()

String getParameter ( final String  name)
Parameters
nameThe name of the parameter to be returned
Returns
the parameter with the given name

Implemented in NTLMScheme, and RFC2617Scheme.

◆ getRealm()

String getRealm ( )

If the concept of an authentication realm is not applicable to the given authentication scheme, returns null.

Returns
the authentication realm

Implemented in RFC2617Scheme, and NTLMScheme.

◆ isConnectionBased()

boolean isConnectionBased ( )
Returns
true if the scheme is connection based, false if the scheme is request based.

Implemented in DigestScheme, BasicScheme, and NTLMScheme.

◆ isComplete()

boolean isComplete ( )

This method tests if the authorization process has been completed, either successfully or unsuccessfully, that is, all the required authorization challenges have been processed in their entirety.

Returns
true if the authentication process has been completed, false otherwise.

Implemented in DigestScheme, NTLMScheme, and BasicScheme.

◆ authenticate()

Header authenticate ( Credentials  credentials,
HttpRequest  request 
) throws AuthenticationException
Parameters
credentialsThe set of credentials to be used for athentication
requestThe request being authenticated
Exceptions
AuthenticationExceptionif authorization string cannot be generated due to an authentication failure
Returns
the authorization string

Implemented in DigestScheme, BasicScheme, and NTLMScheme.