Class FileSystemConsumerStore
java.lang.Object
org.eclipse.lyo.server.oauth.core.consumer.AbstractConsumerStore
org.eclipse.lyo.server.oauth.consumerstore.FileSystemConsumerStore
- All Implemented Interfaces:
ConsumerStore
A simple RDF consumer store backed by an XML file on the filesystem.
NOTE: The shared consumer secret is stored as Base64 and is only obfuscated, not encrypted (unless
the ctor with an encryption key is used).
- Author:
- Samuel Padgett
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileSystemConsumerStore
(String oauthStoreRoot) FileSystemConsumerStore
(String oauthStoreRoot, String encryptionKey) This provides a extra parameter for storing the consumer secret encrypted by a userKeyFileSystemConsumerStore
(Model model, String oauthStoreRoot) -
Method Summary
Modifier and TypeMethodDescriptionaddConsumer
(LyoOAuthConsumer consumer) Adds a new consumer.void
Closes the consumer store.protected void
protected String
protected String
protected LyoOAuthConsumer
fromResource
(Resource resource) protected SecretKey
getSecreteKey
(String encryptionKey) It generate Secret Key of length 32 bytes using user provided key.protected void
removeConsumer
(String consumerKey) Removes a consumer.protected void
removeProperties
(String consumerKey) Removes any properties previously associated with the consumer.protected void
removeProperties
(LyoOAuthConsumer consumer) Removes any properties previously associated with the consumer.protected Resource
toResource
(LyoOAuthConsumer consumer) updateConsumer
(LyoOAuthConsumer consumer) Updates a consumer.protected void
Methods inherited from class org.eclipse.lyo.server.oauth.core.consumer.AbstractConsumerStore
add, addAll, getAllConsumers, getConsumer, getConsumer, remove
-
Field Details
-
LYO_OAUTH_NAMESPACE
- See Also:
-
CONSUMER_RESOURCE
- See Also:
-
CALLBACK_URL
- See Also:
-
CONSUMER_NAME
- See Also:
-
CONSUMER_KEY
- See Also:
-
CONSUMER_SECRET
- See Also:
-
PROVISIONAL
- See Also:
-
TRUSTED
- See Also:
-
AES_CIPHER
- See Also:
-
-
Constructor Details
-
FileSystemConsumerStore
public FileSystemConsumerStore(String oauthStoreRoot) throws SQLException, ConsumerStoreException, ClassNotFoundException -
FileSystemConsumerStore
public FileSystemConsumerStore(String oauthStoreRoot, String encryptionKey) throws SQLException, ConsumerStoreException, ClassNotFoundException This provides a extra parameter for storing the consumer secret encrypted by a userKey- Parameters:
oauthStoreRoot
-encryptionKey
-- Throws:
SQLException
ConsumerStoreException
ClassNotFoundException
-
FileSystemConsumerStore
- Throws:
ConsumerStoreException
-
-
Method Details
-
createModel
protected void createModel() -
writeModel
- Throws:
FileNotFoundException
-
loadConsumers
- Throws:
ConsumerStoreException
-
addConsumer
Description copied from interface:ConsumerStore
Adds a new consumer.- Parameters:
consumer
- the consumer- Returns:
- the previous consumer associated with this key or null if there wasn't one
- Throws:
ConsumerStoreException
-
removeConsumer
Description copied from interface:ConsumerStore
Removes a consumer.- Returns:
- the removed consumer or null if it wasn't previously in the store
- Throws:
ConsumerStoreException
- on errors
-
updateConsumer
Description copied from interface:ConsumerStore
Updates a consumer.- Parameters:
consumer
- the consumer- Returns:
- the same consumer or null if it wasn't previously in the store
- Throws:
ConsumerStoreException
- on errors
-
closeConsumerStore
public void closeConsumerStore()Description copied from interface:ConsumerStore
Closes the consumer store. It is unavailable for further use.- Specified by:
closeConsumerStore
in interfaceConsumerStore
- Specified by:
closeConsumerStore
in classAbstractConsumerStore
-
removeProperties
Removes any properties previously associated with the consumer.- Parameters:
consumerKey
- the consumer key
-
removeProperties
Removes any properties previously associated with the consumer.- Parameters:
consumer
- the consumer
-
toResource
- Throws:
UnsupportedEncodingException
-
fromResource
- Throws:
UnsupportedEncodingException
-
encrypt
-
decrypt
-
getSecreteKey
It generate Secret Key of length 32 bytes using user provided key.- Returns:
-