public class FileBasedRevocationRegistry extends FileBasedSTSOperations implements RevocationRegistry
FileBasedRevocationRegistry
is a revocation registry implementation that uses a file to store the ids of the
revoked
(canceled) security tokens. By default all ids are stored in $HOME/picketlink-store/sts/revoked.ids but a different
location
can be specified through the constructor that takes the file name as a parameter.
NOTE: this implementation use a local cache to avoid reading the file system every time a revocation check is made, making this registry a bad choice for distributed scenarios. Even though the registry file is updated whenever a new id is revoked, each node in the cluster will have its own cached view and thus a token that has been canceled by one node may be accepted by another live node as the caches are not refreshed or synchronized.
Modifier and Type | Field and Description |
---|---|
protected static String |
FILE_NAME |
protected File |
registryFile |
protected static Set<String> |
revokedIds |
directory, logger
Constructor and Description |
---|
FileBasedRevocationRegistry()
Creates an instance of
RevocationRegistryFile that stores the canceled ids in the default
$HOME/picketlink-store/sts/revoked.ids file. |
FileBasedRevocationRegistry(String registryFileName)
Creates an instance of
RevocationRegistryFile that stores the canceled ids in specified file. |
Modifier and Type | Method and Description |
---|---|
boolean |
isRevoked(String tokenType,
String id)
Indicates whether the token with the specified id has been revoked or not.
|
void |
revokeToken(String tokenType,
String id)
Adds the specified id to the revocation registry.
|
create
protected static final String FILE_NAME
protected File registryFile
public FileBasedRevocationRegistry()
Creates an instance of RevocationRegistryFile
that stores the canceled ids in the default
$HOME/picketlink-store/sts/revoked.ids
file.
public FileBasedRevocationRegistry(String registryFileName)
Creates an instance of RevocationRegistryFile
that stores the canceled ids in specified file.
registryFile
- a String
that indicates the file that must be used to store revoked ids.public boolean isRevoked(String tokenType, String id)
RevocationRegistry
Indicates whether the token with the specified id has been revoked or not.
isRevoked
in interface RevocationRegistry
tokenType
- a String
representing the token type.id
- a String
representing the token id.true
if the specified id has been revoked; false
otherwise.public void revokeToken(String tokenType, String id)
RevocationRegistry
Adds the specified id to the revocation registry. The security token type can be used to distinguish tokens that may have the same id but that are of different types.
revokeToken
in interface RevocationRegistry
tokenType
- a String
representing the security token type.id
- the id to registered.Copyright © 2018 JBoss by Red Hat. All rights reserved.