|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.Authenticator
com.ehsbe.commons.util.NetAuthenticator
com.ehsbe.commons.gui.JxNetAuthenticator
public abstract class JxNetAuthenticator
A GUI enabled Authenticator, which fires up a login dialog on
NetAuthenticator.getPasswordAuthentications()
to let the user enter
username/password and optionally a master password for encryption/decryption
of an external password store.
To save the internal password store back to the external form, call
close()
on this instance.
Authenticator.setDefault(java.net.Authenticator)
,
NetAuthenticator
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.net.Authenticator |
---|
Authenticator.RequestorType |
Constructor Summary | |
---|---|
JxNetAuthenticator()
Create a new JxNetAuthenticator. |
|
JxNetAuthenticator(Component guiAnchor)
Create a new JxNetAuthenticator. |
Method Summary | |
---|---|
void |
close()
Reset this instance to its initial state. |
Component |
getGuiAnchor()
Set the "anchor" to which dialogs should be relative positioned. |
protected char[] |
getMasterPassword(Boolean type)
Get the master password to generate the secret key for decrypting the encrypted password store. |
protected Set<PasswordAuthentication> |
getPasswordAuthentications()
Fires up the authentication dialog to obtain a username/password pair for the authorization requesting entity. |
protected abstract byte[] |
getPasswordStore()
Get the encrypted password store. |
protected PasswordAuthentication |
getUserPass(Set<PasswordAuthentication> pa)
Invoke a dialog to let the user enter the required username and password. |
void |
setGuiAnchor(Component anchor)
Set the "anchor" to which dialogs should be relative positioned. |
protected abstract void |
setPasswordStore(byte[] store)
Set/save the encrypted password store. |
Methods inherited from class com.ehsbe.commons.util.NetAuthenticator |
---|
add, cleanPass, getPasswordAuthentication, isEmpty, isSecretKeySet, read, read, remove, reset, setSecretKey, store, store, storeModified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JxNetAuthenticator()
public JxNetAuthenticator(Component guiAnchor)
guiAnchor
- anchor for dialogs. If nont null
, dialogs are
positioned relative to the given anchor, otherwise centered on the screen.Window.setLocationRelativeTo(Component)
,
Util.center(Component)
Method Detail |
---|
protected abstract byte[] getPasswordStore()
null
if there is none, the store otherwise.protected abstract void setPasswordStore(byte[] store)
store
- the encrypted store to save.close()
protected char[] getMasterPassword(Boolean type)
type
- if null
, ask for the existing master password to
encrypt/decrypt the password store, if true
ask for a
initial master password to set for a new password store, otherwise
ask for the old and a new master password to set.
null
if not password could be obtained from the user,
i.e. don't ask again, the password otherwise.protected PasswordAuthentication getUserPass(Set<PasswordAuthentication> pa)
pa
- a list of username/password pairs from the password store
null
if dialog has been canceled, i.e. no username/password
pair is available, the appropriate pair otherwise.protected Set<PasswordAuthentication> getPasswordAuthentications()
getPasswordAuthentications
in class NetAuthenticator
null
if not entries are found, a copy of the set of possible
authentication pairs matching the entity requesting authentication
otherwise.getPasswordStore()
,
getMasterPassword(Boolean)
,
getUserPass(Set)
public void close() throws SecurityException
setPasswordStore(byte[])
called. Finally the internal password store as well the its secret key
gets cleared.
SecurityException
NetAuthenticator.storeModified()
,
NetAuthenticator.isSecretKeySet()
,
NetAuthenticator.store()
,
NetAuthenticator.reset()
public void setGuiAnchor(Component anchor)
anchor
- anchor to set. Might be null
, if dialogs should
be centered on the screen.Window.setLocationRelativeTo(Component)
,
Util.center(Component)
public Component getGuiAnchor()
null
, if dialogs are currently
centered on the screen.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |