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

public abstract Class CredentialItem

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.transport.CredentialItem.StringType, org.eclipse.jgit.transport.CredentialItem.CharArrayType, org.eclipse.jgit.transport.CredentialItem.YesNoType, org.eclipse.jgit.transport.CredentialItem.InformationalMessage
Imports
java.util.Arrays, org.eclipse.jgit.internal.JGitText

A credential requested from a org.eclipse.jgit.transport.CredentialsProvider. Most users should work with the specialized subclasses: This class is not thread-safe. Applications should construct their own instance for each use, as the value is held within the CredentialItem object.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
CredentialItem.CharArrayType

An item whose value is stored as a char[] and is therefore clearable.

public static class
CredentialItem.InformationalMessage

An advice message presented to the user, with no response required.

public static class
CredentialItem.Password

Prompt for a password, which is masked on input.

public static class
CredentialItem.StringType

An item whose value is stored as a string.

public static class
CredentialItem.Username

Prompt for a username, which is not masked on input.

public static class
CredentialItem.YesNoType

An item whose value is a boolean choice, presented as Yes/No.

Field Summary

Modifier and TypeField and Description
private final String
private final boolean

Constructor Summary

AccessConstructor and Description
public
CredentialItem(String
prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.
promptText
,
boolean
true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.
maskValue
)

Initialize a prompt.

Method Summary

Modifier and TypeMethod and Description
public abstract void
clear()

Clear the stored value, destroying it as much as possible.

public String

Returns:

prompt to display to the user.
getPromptText
()

Get prompt to display to the user.

public boolean

Returns:

true if the value should be masked when entered.
isValueSecure
()

Whether the value should be masked when entered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

promptTextback to summary
private final String promptText
valueSecureback to summary
private final boolean valueSecure

Constructor Detail

CredentialItemback to summary
public CredentialItem(String promptText, boolean maskValue)

Initialize a prompt.

Parameters
promptText:String

prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.

maskValue:boolean

true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.

Method Detail

clearback to summary
public abstract void clear()

Clear the stored value, destroying it as much as possible.

getPromptTextback to summary
public String getPromptText()

Get prompt to display to the user.

Returns:String

prompt to display to the user.

isValueSecureback to summary
public boolean isValueSecure()

Whether the value should be masked when entered.

Returns:boolean

true if the value should be masked when entered.

org.eclipse.jgit.transport back to summary

public Class CredentialItem.CharArrayType

extends CredentialItem
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.transport.CredentialItem.Password

An item whose value is stored as a char[] and is therefore clearable.

Field Summary

Modifier and TypeField and Description
private char[]

Constructor Summary

AccessConstructor and Description
public
CharArrayType(String
prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.
promptText
,
boolean
true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.
maskValue
)

Initialize a prompt for a secure value stored in a character array.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Destroys the current value, clearing the internal array.

public char[]

Returns:

the current value array. The actual internal array is returned, reducing the number of copies present in memory.
getValue
()

Get the current value.

public void
setValue(char[]
if not null, the array is copied.
newValue
)

Set the new value, clearing the old value array.

public void
setValueNoCopy(char[]
the new internal array. The array is NOT copied.
newValue
)

Set the new value, clearing the old value array.

Inherited from org.eclipse.jgit.transport.CredentialItem:
getPromptTextisValueSecure

Field Detail

valueback to summary
private char[] value

Constructor Detail

CharArrayTypeback to summary
public CharArrayType(String promptText, boolean maskValue)

Initialize a prompt for a secure value stored in a character array.

Parameters
promptText:String

prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.

maskValue:boolean

true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.

Method Detail

clearback to summary
public void clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Destroys the current value, clearing the internal array.

Annotations
@Override
getValueback to summary
public char[] getValue()

Get the current value. The returned array will be cleared out when clear() is called. Callers that need the array elements to survive should delay invoking clear() until the value is no longer necessary.

Returns:char[]

the current value array. The actual internal array is returned, reducing the number of copies present in memory.

setValueback to summary
public void setValue(char[] newValue)

Set the new value, clearing the old value array.

Parameters
newValue:char[]

if not null, the array is copied.

setValueNoCopyback to summary
public void setValueNoCopy(char[] newValue)

Set the new value, clearing the old value array.

Parameters
newValue:char[]

the new internal array. The array is NOT copied.

org.eclipse.jgit.transport back to summary

public Class CredentialItem.InformationalMessage

extends CredentialItem
Class Inheritance

An advice message presented to the user, with no response required.

Constructor Summary

AccessConstructor and Description
public
InformationalMessage(String
message to display to the user.
messageText
)

Initialize an informational message.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

Inherited from org.eclipse.jgit.transport.CredentialItem:
getPromptTextisValueSecure

Constructor Detail

InformationalMessageback to summary
public InformationalMessage(String messageText)

Initialize an informational message.

Parameters
messageText:String

message to display to the user.

Method Detail

clearback to summary
public void clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Doc from org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

Annotations
@Override
org.eclipse.jgit.transport back to summary

public Class CredentialItem.Password

extends CharArrayType
Class Inheritance

Prompt for a password, which is masked on input.

Constructor Summary

AccessConstructor and Description
public
Password()

Initialize a new password item, with a default password prompt.

public
Password(String
prompt message
msg
)

Initialize a new password item, with given prompt.

Method Summary

Inherited from org.eclipse.jgit.transport.CredentialItem.CharArrayType:
cleargetValuesetValuesetValueNoCopy

Constructor Detail

Passwordback to summary
public Password()

Initialize a new password item, with a default password prompt.

Passwordback to summary
public Password(String msg)

Initialize a new password item, with given prompt.

Parameters
msg:String

prompt message

org.eclipse.jgit.transport back to summary

public Class CredentialItem.StringType

extends CredentialItem
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.transport.CredentialItem.Username

An item whose value is stored as a string. When working with secret data, consider CharArrayType instead, as the internal members of the array can be cleared, reducing the chances that the password is left in memory after authentication is completed.

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
public
StringType(String
prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.
promptText
,
boolean
true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.
maskValue
)

Initialize a prompt for a single string.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

public String

Returns:

the current value
getValue
()

Get value

public void
setValue(String
the new value
newValue
)

Set value

Inherited from org.eclipse.jgit.transport.CredentialItem:
getPromptTextisValueSecure

Field Detail

valueback to summary
private String value

Constructor Detail

StringTypeback to summary
public StringType(String promptText, boolean maskValue)

Initialize a prompt for a single string.

Parameters
promptText:String

prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.

maskValue:boolean

true if the value should be masked from displaying during input. This should be true for passwords and other secrets, false for names and other public data.

Method Detail

clearback to summary
public void clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Doc from org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

Annotations
@Override
getValueback to summary
public String getValue()

Get value

Returns:String

the current value

setValueback to summary
public void setValue(String newValue)

Set value

Parameters
newValue:String

the new value

org.eclipse.jgit.transport back to summary

public Class CredentialItem.Username

extends StringType
Class Inheritance

Prompt for a username, which is not masked on input.

Constructor Summary

AccessConstructor and Description
public
Username()

Initialize a new username item, with a default username prompt.

Method Summary

Inherited from org.eclipse.jgit.transport.CredentialItem.StringType:
cleargetValuesetValue

Constructor Detail

Usernameback to summary
public Username()

Initialize a new username item, with a default username prompt.

org.eclipse.jgit.transport back to summary

public Class CredentialItem.YesNoType

extends CredentialItem
Class Inheritance

An item whose value is a boolean choice, presented as Yes/No.

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
public
YesNoType(String
prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.
promptText
)

Initialize a prompt for a single boolean answer.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

public boolean

Returns:

the current value
getValue
()

Get value

public void
setValue(boolean
the new value
newValue
)

Set the new value.

Inherited from org.eclipse.jgit.transport.CredentialItem:
getPromptTextisValueSecure

Field Detail

valueback to summary
private boolean value

Constructor Detail

YesNoTypeback to summary
public YesNoType(String promptText)

Initialize a prompt for a single boolean answer.

Parameters
promptText:String

prompt to display to the user alongside of the input field. Should be sufficient text to indicate what to supply for this item.

Method Detail

clearback to summary
public void clear()

Implements abstract org.eclipse.jgit.transport.CredentialItem.clear.

Doc from org.eclipse.jgit.transport.CredentialItem.clear.

Clear the stored value, destroying it as much as possible.

Annotations
@Override
getValueback to summary
public boolean getValue()

Get value

Returns:boolean

the current value

setValueback to summary
public void setValue(boolean newValue)

Set the new value.

Parameters
newValue:boolean

the new value