Top Description Inners Fields Constructors Methods
org.eclipse.jgit.transport

pack-priv abstract Class HttpAuthMethod

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.transport.HttpAuthMethod.None, org.eclipse.jgit.transport.HttpAuthMethod.Basic, org.eclipse.jgit.transport.HttpAuthMethod.Digest, org.eclipse.jgit.transport.HttpAuthMethod.Negotiate
Static Imports
java.nio.charset.StandardCharsets.UTF_8, org.eclipse.jgit.util.HttpSupport.HDR_AUTHORIZATION, .HttpSupport.HDR_WWW_AUTHENTICATE

Support class to populate user authentication data on a connection.

Instances of an HttpAuthMethod are not thread-safe, as some implementations may need to maintain per-connection state information.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
HttpAuthMethod.Basic

Performs HTTP basic authentication (plaintext username/password).

private static class
HttpAuthMethod.Digest

Performs HTTP digest authentication.

private static class
private static class
HttpAuthMethod.None

Performs no user authentication.

public static enum
HttpAuthMethod.Type

Enum listing the http authentication method types supported by jgit.

Field Summary

Modifier and TypeField and Description
pack-priv static final String
pack-priv static final String
protected final HttpAuthMethod.Type

Constructor Summary

AccessConstructor and Description
protected
HttpAuthMethod(HttpAuthMethod.Type
authentication method type
type
)

Constructor for HttpAuthMethod.

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean

Returns:

true if the authentication method is able to provide authorization for the given URI
authorize
(URIish
the URI used to create the connection.
uri
,
CredentialsProvider
the credentials provider, or null. If provided, credentials in the URI are ignored.
credentialsProvider
)

Update this method with the credentials from the URIish.

pack-priv abstract void
authorize(String
username
user
,
String
password
pass
)

Update this method with the given username and password pair.

pack-priv abstract void
configureRequest(HttpConnection
the connection to configure
conn
)

Update connection properties based on this authentication method.

public HttpAuthMethod.Type

Returns:

the method type
getType
()

Gives the method type associated to this http auth method

pack-priv static HttpAuthMethod

Returns:

new authentication method to try.
scanResponse
(final HttpConnection
the connection that failed.
conn
,
Collection<HttpAuthMethod.Type>
authentication types to be ignored.
ignoreTypes
)

Handle an authentication failure and possibly return a new response.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_STRINGback to summary
pack-priv static final String EMPTY_STRING
SCHEMA_NAME_SEPARATORback to summary
pack-priv static final String SCHEMA_NAME_SEPARATOR
typeback to summary
protected final HttpAuthMethod.Type type

Constructor Detail

HttpAuthMethodback to summary
protected HttpAuthMethod(HttpAuthMethod.Type type)

Constructor for HttpAuthMethod.

Parameters
type:HttpAuthMethod.Type

authentication method type

Method Detail

authorizeback to summary
pack-priv boolean authorize(URIish uri, CredentialsProvider credentialsProvider)

Update this method with the credentials from the URIish.

Parameters
uri:URIish

the URI used to create the connection.

credentialsProvider:CredentialsProvider

the credentials provider, or null. If provided, credentials in the URI are ignored.

Returns:boolean

true if the authentication method is able to provide authorization for the given URI

authorizeback to summary
pack-priv abstract void authorize(String user, String pass)

Update this method with the given username and password pair.

Parameters
user:String

username

pass:String

password

configureRequestback to summary
pack-priv abstract void configureRequest(HttpConnection conn) throws IOException

Update connection properties based on this authentication method.

Parameters
conn:HttpConnection

the connection to configure

Exceptions
IOException:
if an IO error occurred
getTypeback to summary
public HttpAuthMethod.Type getType()

Gives the method type associated to this http auth method

Returns:HttpAuthMethod.Type

the method type

scanResponseback to summary
pack-priv static HttpAuthMethod scanResponse(final HttpConnection conn, Collection<HttpAuthMethod.Type> ignoreTypes)

Handle an authentication failure and possibly return a new response.

Parameters
conn:HttpConnection

the connection that failed.

ignoreTypes:Collection<HttpAuthMethod.Type>

authentication types to be ignored.

Returns:HttpAuthMethod

new authentication method to try.

org.eclipse.jgit.transport back to summary

private Class HttpAuthMethod.Basic

extends HttpAuthMethod
Class Inheritance

Performs HTTP basic authentication (plaintext username/password).

Field Summary

Modifier and TypeField and Description
private String
private String
Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
EMPTY_STRINGSCHEMA_NAME_SEPARATORtype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
authorize(String
username
username
,
String
password
password
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

pack-priv void
configureRequest(HttpConnection
the connection to configure
conn
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
authorizegetTypescanResponse

Field Detail

passback to summary
private String pass
userback to summary
private String user

Constructor Detail

Basicback to summary
public Basic()

Method Detail

authorizeback to summary
pack-priv void authorize(String username, String password)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

Parameters
username:String

username

password:String

password

Annotations
@Override
configureRequestback to summary
pack-priv void configureRequest(HttpConnection conn) throws IOException

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Parameters
conn:HttpConnection

the connection to configure

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
org.eclipse.jgit.transport back to summary

private Class HttpAuthMethod.Digest

extends HttpAuthMethod
Class Inheritance

Performs HTTP digest authentication.

Field Summary

Modifier and TypeField and Description
private static final char[]
private final Map<String, String>
private String
private static final SecureRandom
private int
private String
Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
EMPTY_STRINGSCHEMA_NAME_SEPARATORtype

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
authorize(String
username
username
,
String
password
password
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

pack-priv void
configureRequest(HttpConnection
the connection to configure
conn
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

private static String
H(String data)

private static String
KD(String secret, String data)

private static String
LHEX(byte[] bin)

private static MessageDigest
private static Map<String, String>
parse(String auth)

private static String
uri(URL u)

Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
authorizegetTypescanResponse

Field Detail

LHEXback to summary
private static final char[] LHEX
paramsback to summary
private final Map<String, String> params
passback to summary
private String pass
PRNGback to summary
private static final SecureRandom PRNG
requestCountback to summary
private int requestCount
userback to summary
private String user

Constructor Detail

Digestback to summary
pack-priv Digest(String hdr)

Method Detail

authorizeback to summary
pack-priv void authorize(String username, String password)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

Parameters
username:String

username

password:String

password

Annotations
@Override
configureRequestback to summary
pack-priv void configureRequest(HttpConnection conn) throws IOException

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Parameters
conn:HttpConnection

the connection to configure

Annotations
@SuppressWarnings:boxing
@Override
Exceptions
IOException:
if an IO error occurred
Hback to summary
private static String H(String data)
KDback to summary
private static String KD(String secret, String data)
LHEXback to summary
private static String LHEX(byte[] bin)
newMD5back to summary
private static MessageDigest newMD5()
parseback to summary
private static Map<String, String> parse(String auth)
uriback to summary
private static String uri(URL u)
org.eclipse.jgit.transport back to summary

private Class HttpAuthMethod.Negotiate

extends HttpAuthMethod
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final GSSManagerFactory
private static final Oid
private final byte[]
Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
EMPTY_STRINGSCHEMA_NAME_SEPARATORtype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
authorize(String
username
user
,
String
password
pass
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

pack-priv void
configureRequest(HttpConnection
the connection to configure
conn
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
authorizegetTypescanResponse

Field Detail

GSS_MANAGER_FACTORYback to summary
private static final GSSManagerFactory GSS_MANAGER_FACTORY
OIDback to summary
private static final Oid OID
prevTokenback to summary
private final byte[] prevToken

Constructor Detail

Negotiateback to summary
public Negotiate(String hdr)

Method Detail

authorizeback to summary
pack-priv void authorize(String user, String pass)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

Parameters
user:String

username

pass:String

password

Annotations
@Override
configureRequestback to summary
pack-priv void configureRequest(HttpConnection conn) throws IOException

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Parameters
conn:HttpConnection

the connection to configure

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
org.eclipse.jgit.transport back to summary

private Class HttpAuthMethod.None

extends HttpAuthMethod
Class Inheritance

Performs no user authentication.

Field Summary

Modifier and TypeField and Description
pack-priv static final HttpAuthMethod.None
Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
EMPTY_STRINGSCHEMA_NAME_SEPARATORtype

Constructor Summary

AccessConstructor and Description
public
None()

Method Summary

Modifier and TypeMethod and Description
pack-priv void
authorize(String
username
user
,
String
password
pass
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

pack-priv void
configureRequest(HttpConnection
the connection to configure
conn
)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Inherited from org.eclipse.jgit.transport.HttpAuthMethod:
authorizegetTypescanResponse

Field Detail

INSTANCEback to summary
pack-priv static final HttpAuthMethod.None INSTANCE

Constructor Detail

Noneback to summary
public None()

Method Detail

authorizeback to summary
pack-priv void authorize(String user, String pass)

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.authorize.

Update this method with the given username and password pair.

Parameters
user:String

username

pass:String

password

Annotations
@Override
configureRequestback to summary
pack-priv void configureRequest(HttpConnection conn) throws IOException

Implements abstract org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Doc from org.eclipse.jgit.transport.HttpAuthMethod.configureRequest.

Update connection properties based on this authentication method.

Parameters
conn:HttpConnection

the connection to configure

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
org.eclipse.jgit.transport back to summary

public sealed Enum HttpAuthMethod.Type

extends Enum<HttpAuthMethod.Type>
Class Inheritance

Enum listing the http authentication method types supported by jgit. They are sorted by priority order!!!

Field Summary

Modifier and TypeField and Description
public static final HttpAuthMethod.Type
public static final HttpAuthMethod.Type
public static final HttpAuthMethod.Type
public static final HttpAuthMethod.Type

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public abstract String

Returns:

the name of the authentication scheme in the form to be used in HTTP authentication headers as specified in RFC2617 and RFC4559
getSchemeName
()

public abstract HttpAuthMethod

Returns:

a configured HttpAuthMethod instance
method
(String
the http header
hdr
)

Creates a HttpAuthMethod instance configured with the provided HTTP WWW-Authenticate header.

public static HttpAuthMethod.Type
public static HttpAuthMethod.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BASICback to summary
public static final HttpAuthMethod.Type BASIC
DIGESTback to summary
public static final HttpAuthMethod.Type DIGEST
NEGOTIATEback to summary
public static final HttpAuthMethod.Type NEGOTIATE
NONEback to summary
public static final HttpAuthMethod.Type NONE

Constructor Detail

Typeback to summary
private Type()

Method Detail

getSchemeNameback to summary
public abstract String getSchemeName()
Returns:String

the name of the authentication scheme in the form to be used in HTTP authentication headers as specified in RFC2617 and RFC4559

methodback to summary
public abstract HttpAuthMethod method(String hdr)

Creates a HttpAuthMethod instance configured with the provided HTTP WWW-Authenticate header.

Parameters
hdr:String

the http header

Returns:HttpAuthMethod

a configured HttpAuthMethod instance

valueOfback to summary
public static HttpAuthMethod.Type valueOf(String name)
valuesback to summary
public static HttpAuthMethod.Type[] values()