Class AuthProvider
- All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
While callers may invoke login directly,
the provider may also invoke login on behalf of callers
if it determines that a login must be performed
prior to certain operations.
- Since:
- 1.5
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Provider
Provider.ServiceModifier and TypeClassDescriptionstatic classThe description of a security service. -
Field Summary
Fields inherited from class Properties
defaultsModifier and TypeFieldDescriptionprotected PropertiesA property list that contains default values for any keys not found in this property list. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAuthProvider(String name, double version, String info) Deprecated.protectedAuthProvider(String name, String versionStr, String info) Constructs a provider with the specified name, version string, and information. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidlogin(Subject subject, CallbackHandler handler) Log in to this provider.abstract voidlogout()Log out from this provider.abstract voidsetCallbackHandler(CallbackHandler handler) Set aCallbackHandler.Methods inherited from class Provider
clear, compute, computeIfAbsent, computeIfPresent, configure, elements, entrySet, forEach, get, getInfo, getName, getOrDefault, getProperty, getService, getServices, getVersion, getVersionStr, isConfigured, keys, keySet, load, merge, put, putAll, putIfAbsent, putService, remove, remove, removeService, replace, replace, replaceAll, toString, valuesModifier and TypeMethodDescriptionvoidclear()Clears thisProviderso that it no longer contains the properties used to look up facilities implemented by theProvider.Attempts to compute a mapping for the specified key and its current mapped value (ornullif there is no current mapping).computeIfAbsent(Object key, Function<? super Object, ? extends Object> mappingFunction) If the specified key is not already associated with a value (or is mapped tonull), attempts to compute its value using the given mapping function and enters it into this map unlessnull.computeIfPresent(Object key, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.Apply the supplied configuration argument to thisProviderinstance and return the configuredProvider.elements()Returns an enumeration of the values in this hashtable.entrySet()Returns an unmodifiable Set view of the property entries contained in thisProvider.voidforEach(BiConsumer<? super Object, ? super Object> action) Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.Returns the value to which the specified key is mapped, ornullif this map contains no mapping for the key.getInfo()Returns a human-readable description of theProviderand its services.getName()Returns the name of thisProvider.getOrDefault(Object key, Object defaultValue) Returns the value to which the specified key is mapped, ordefaultValueif this map contains no mapping for the key.getProperty(String key) Searches for the property with the specified key in this property list.getService(String type, String algorithm) Get the service describing this Provider's implementation of the specified type of this algorithm or alias.Get an unmodifiable Set of all services supported by thisProvider.doubleDeprecated.useProvider.getVersionStr()instead.Returns the version string for thisProvider.booleanCheck if thisProviderinstance has been configured.keys()Returns an enumeration of the keys in this hashtable.keySet()Returns an unmodifiable Set view of the property keys contained in thisProvider.voidload(InputStream inStream) Reads a property list (key and element pairs) from the input stream.merge(Object key, Object value, BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) If the specified key is not already associated with a value or is associated withnull, associates it with the given value.Sets thekeyproperty to have the specifiedvalue.voidCopies all the mappings from the specified Map to thisProvider.putIfAbsent(Object key, Object value) If the specified key is not already associated with a value (or is mapped tonull) associates it with the given value and returnsnull, else returns the current value.protected voidAdd a service.Removes thekeyproperty (and its correspondingvalue).booleanRemoves the entry for the specified key only if it is currently mapped to the specified value.protected voidRemove a service previously added usingputService().Replaces the entry for the specified key only if it is currently mapped to some value.booleanReplaces the entry for the specified key only if currently mapped to the specified value.voidreplaceAll(BiFunction<? super Object, ? super Object, ? extends Object> function) Replaces each entry's value with the result of invoking the given function on that entry, in the order entries are returned by an entry set iterator, until all entries have been processed or the function throws an exception.toString()Returns a string with the name and the version string of thisProvider.values()Returns an unmodifiable Collection view of the property values contained in thisProvider.Methods inherited from class Properties
clone, contains, containsKey, containsValue, equals, getProperty, hashCode, isEmpty, list, list, load, loadFromXML, propertyNames, rehash, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNamesModifier and TypeMethodDescriptionclone()Creates a shallow copy of this hashtable.booleanTests if some key maps into the specified value in this hashtable.booleancontainsKey(Object key) Tests if the specified object is a key in this hashtable.booleancontainsValue(Object value) Returns true if this hashtable maps one or more keys to this value.booleanCompares the specified Object with this Map for equality, as per the definition in the Map interface.getProperty(String key, String defaultValue) Searches for the property with the specified key in this property list.inthashCode()Returns the hash code value for this Map as per the definition in the Map interface.booleanisEmpty()Tests if this hashtable maps no keys to values.voidlist(PrintStream out) Prints this property list out to the specified output stream.voidlist(PrintWriter out) Prints this property list out to the specified output stream.voidReads a property list (key and element pairs) from the input character stream in a simple line-oriented format.voidLoads all of the properties represented by the XML document on the specified input stream into this properties table.Enumeration<?> Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.protected voidrehash()Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.voidsave(OutputStream out, String comments) Deprecated.This method does not throw an IOException if an I/O error occurs while saving the property list.setProperty(String key, String value) Calls theHashtablemethodput.intsize()Returns the number of keys in this hashtable.voidstore(OutputStream out, String comments) Writes this property list (key and element pairs) in thisPropertiestable to the output stream in a format suitable for loading into aPropertiestable using theload(InputStream)method.voidWrites this property list (key and element pairs) in thisPropertiestable to the output character stream in a format suitable for using theload(Reader)method.voidstoreToXML(OutputStream os, String comment) Emits an XML document representing all of the properties contained in this table.voidstoreToXML(OutputStream os, String comment, String encoding) Emits an XML document representing all of the properties contained in this table, using the specified encoding.voidstoreToXML(OutputStream os, String comment, Charset charset) Emits an XML document representing all of the properties contained in this table, using the specified encoding.Returns an unmodifiable set of keys from this property list where the key and its corresponding value are strings, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
AuthProvider
Deprecated.useAuthProvider(String, String, String)instead.Constructs a provider with the specified name, version number, and information.- Parameters:
name- the provider name.version- the provider version number.info- a description of the provider and its services.
-
AuthProvider
-
-
Method Details
-
login
Log in to this provider.The provider relies on a
CallbackHandlerto obtain authentication information from the caller (a PIN, for example). If the caller passes anullhandler to this method, the provider uses the handler set in thesetCallbackHandlermethod. If no handler was set in that method, the provider queries the auth.login.defaultCallbackHandler security property for the fully qualified class name of a default handler implementation. If the security property is not set, the provider is assumed to have alternative means for obtaining authentication information.- Parameters:
subject- theSubjectwhich may contain principals/credentials used for authentication, or may be populated with additional principals/credentials after successful authentication has completed. This parameter may benull.handler- theCallbackHandlerused by this provider to obtain authentication information from the caller, which may benull- Throws:
IllegalStateException- if the provider requires configuration andProvider.configure(String)has not been calledLoginException- if the login operation fails
-
logout
Log out from this provider.- Throws:
IllegalStateException- if the provider requires configuration andProvider.configure(String)has not been calledLoginException- if the logout operation fails
-
setCallbackHandler
Set aCallbackHandler.The provider uses this handler if one is not passed to the
loginmethod. The provider also uses this handler if it invokesloginon behalf of callers. In either case if a handler is not set via this method, the provider queries the auth.login.defaultCallbackHandler security property for the fully qualified class name of a default handler implementation. If the security property is not set, the provider is assumed to have alternative means for obtaining authentication information.- Parameters:
handler- aCallbackHandlerfor obtaining authentication information, which may benull- Throws:
IllegalStateException- if the provider requires configuration andProvider.configure(String)has not been called
-
AuthProvider(String, String, String)instead.