Class JCEKSPasswordAliasStore

java.lang.Object
org.glassfish.security.services.impl.JCEKSPasswordAliasStore
All Implemented Interfaces:
org.glassfish.api.admin.PasswordAliasStore
Direct Known Subclasses:
JCEKSDomainPasswordAliasStore

public class JCEKSPasswordAliasStore extends Object implements org.glassfish.api.admin.PasswordAliasStore
Provides the PasswordAliasStore behavior using a JCEKS keystore.

The keystore is actually managed by the PasswordAdapter, to which this implementation currently delegates its work.

Note that this service is currently per-lookup. This is so that each use of the alias store gets the current on-disk information. Ideally we can change this when we can use Java 7 features, including the WatchService feature.

This class's methods are not synchronized because the PasswordAdapter's methods are. If this implementation changes so that it no longer delegates to those synchronized PasswordAdapter methods, then make sure that the implementation is thread-safe.

Note that the domain-scoped password alias store service class extends this class. As a service, that class will be instantiated using the no-args constructor. So the actual initialization of the class occurs in the init method. The domain-scoped service class invokes the init method itself. Any code that needs to create some other alias store can use the newInstance method to provide the location of the alias store file and the password.

Author:
tjquinn
  • Constructor Details

    • JCEKSPasswordAliasStore

      public JCEKSPasswordAliasStore()
  • Method Details

    • init

      protected final void init(String pathToAliasStore, char[] storePassword)
    • newInstance

      public static JCEKSPasswordAliasStore newInstance(String pathToAliasStore, char[] storePassword)
    • clear

      public void clear()
      Specified by:
      clear in interface org.glassfish.api.admin.PasswordAliasStore
    • put

      public void put(String alias, char[] password)
      Specified by:
      put in interface org.glassfish.api.admin.PasswordAliasStore
    • putAll

      public void putAll(org.glassfish.api.admin.PasswordAliasStore otherStore)
      Specified by:
      putAll in interface org.glassfish.api.admin.PasswordAliasStore
    • putAll

      public void putAll(Map<String,char[]> settings)
      Specified by:
      putAll in interface org.glassfish.api.admin.PasswordAliasStore
    • remove

      public void remove(String alias)
      Specified by:
      remove in interface org.glassfish.api.admin.PasswordAliasStore
    • containsKey

      public boolean containsKey(String alias)
      Specified by:
      containsKey in interface org.glassfish.api.admin.PasswordAliasStore
    • get

      public char[] get(String alias)
      Specified by:
      get in interface org.glassfish.api.admin.PasswordAliasStore
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.glassfish.api.admin.PasswordAliasStore
    • keys

      public Iterator<String> keys()
      Specified by:
      keys in interface org.glassfish.api.admin.PasswordAliasStore
    • size

      public int size()
      Specified by:
      size in interface org.glassfish.api.admin.PasswordAliasStore