de.intarsys.tools.authenticate.CachedPasswordProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isrt Show documentation
Show all versions of isrt Show documentation
The basic runtime tools and interfaces for intarsys components.
package de.intarsys.tools.authenticate;
import de.intarsys.tools.authenticate.IPasswordProvider;
import de.intarsys.tools.prompter.IPrompter;
public class CachedPasswordProvider implements IPasswordProvider, IPrompter {
private char[] password;
final private IPasswordProvider passwordProvider;
public CachedPasswordProvider(IPasswordProvider passwordProvider) {
super();
this.passwordProvider = passwordProvider;
}
@Override
public char[] getPassword() {
if (password != null) {
return password;
}
password = getPasswordProvider().getPassword();
return password;
}
public IPasswordProvider getPasswordProvider() {
return passwordProvider;
}
public void setMessage(String message) {
if (getPasswordProvider() instanceof IPrompter) {
((IPrompter) passwordProvider).setMessage(message);
}
}
public void setTitle(String title) {
if (getPasswordProvider() instanceof IPrompter) {
((IPrompter) passwordProvider).setTitle(title);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy