public class ApiKeyManager
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
deleteKey(java.lang.String key)
Deletes the ApiKey from the database
|
ApiKey |
generateApiKey(java.lang.String applicationName,
java.lang.String applicationUrl,
java.lang.String email,
java.lang.String phone,
java.lang.String description)
Generates the new ApiKey and stores it in the db.
|
java.util.List<ApiKey> |
getApiKeys()
Gets the API keys from the database.
|
static ApiKeyManager |
getInstance()
Get singleton instance.
|
boolean |
isKeyValid(java.lang.String key)
Returns true if key is valid.
|
static void |
main(java.lang.String[] args)
For testing and debugging.
|
public static ApiKeyManager getInstance()
public boolean isKeyValid(java.lang.String key)
Synchronized because can have simultaneous access and using a cache.
key - The key to investigatepublic java.util.List<ApiKey> getApiKeys()
public ApiKey generateApiKey(java.lang.String applicationName, java.lang.String applicationUrl, java.lang.String email, java.lang.String phone, java.lang.String description) throws java.lang.IllegalArgumentException, org.hibernate.HibernateException
applicationName - applicationUrl - email - phone - description - java.lang.IllegalArgumentExceptionorg.hibernate.HibernateExceptionpublic void deleteKey(java.lang.String key)
key - public static void main(java.lang.String[] args)
args -