Author: [email protected]
Date: Tue Jul 19 16:40:59 2011
New Revision: 1223
Log:
[AMDATUAUTH-71] Refactored the OAuth service consumer such that the name
doesn't need to be unique necessarily
Modified:
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/OAuthServiceConsumerRegistry.java
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/service/OAuthServiceConsumerRegistryRESTImpl.java
trunk/amdatu-auth/oauth-stores/consumer-store-fs/src/main/java/org/amdatu/authentication/oauth/consumerregistry/fs/service/FSConsumerRegistryImpl.java
trunk/amdatu-auth/tokenprovider/src/main/java/org/amdatu/authentication/tokenprovider/Token.java
Modified:
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/OAuthServiceConsumerRegistry.java
==============================================================================
---
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/OAuthServiceConsumerRegistry.java
(original)
+++
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/OAuthServiceConsumerRegistry.java
Tue Jul 19 16:40:59 2011
@@ -54,20 +54,7 @@
* @throws ConsumerRegistryStorageException
* If an internal error occurred in the consumer registry storage
*/
- OAuthServiceConsumer getConsumer(String consumerKey) throws
ConsumerRegistryStorageException;
-
- /**
- * Returns the oAuth service consumer matching the specified consumer
name. The consumer name is NOT case sensitive,
- * meaning that a consumer named 'Amdatu' is also returned when this
method is invoked with 'amdatu'.
- * If no such consumer could be found null is returned.
- *
- * @param consumerName
- * Name of the consumer to find
- * @return The consumer if found
- * @throws ConsumerRegistryStorageException
- * If an internal error occurred in the consumer registry storage
- */
- OAuthServiceConsumer getConsumerByName(String consumerName) throws
ConsumerRegistryStorageException;
+ OAuthServiceConsumer getConsumer(String consumerKey) throws
ConsumerRegistryStorageException;
/**
* Adds an oAuth service consumer to the registry of the oAuth server. A
ConsumerAlreadyExistsException will be
Modified:
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/service/OAuthServiceConsumerRegistryRESTImpl.java
==============================================================================
---
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/service/OAuthServiceConsumerRegistryRESTImpl.java
(original)
+++
trunk/amdatu-auth/oauth-consumerregistry/src/main/java/org/amdatu/authentication/oauth/consumerregistry/service/OAuthServiceConsumerRegistryRESTImpl.java
Tue Jul 19 16:40:59 2011
@@ -261,16 +261,6 @@
return
Response.status(HttpStatus.SC_UNAUTHORIZED).cacheControl(NO_CACHE_CONTROL).build();
}
- // Now verify if a consumer with the specified name does not
already exist
- OAuthServiceConsumer existingConsumer =
m_registry.getConsumerByName(name);
- if (existingConsumer != null) {
- // In case a consumer with this name already exists, we return
a 400 (bad request)
- ResultBean bean = new ResultBean();
- bean.setMessage("The Application could not be registered, the
name '"
- + existingConsumer.getName() + "' is already in use.
Register your application with a different name.");
- return
Response.status(HttpStatus.SC_BAD_REQUEST).cacheControl(NO_CACHE_CONTROL).entity(bean).build();
- }
-
// Verify that the callback URL starts with http, https or equals
'oob'
if (!callbackUrl.startsWith("http://") &&
!callbackUrl.startsWith("https://") && !"oob".equals(callbackUrl)) {
ResultBean bean = new ResultBean();
Modified:
trunk/amdatu-auth/oauth-stores/consumer-store-fs/src/main/java/org/amdatu/authentication/oauth/consumerregistry/fs/service/FSConsumerRegistryImpl.java
==============================================================================
---
trunk/amdatu-auth/oauth-stores/consumer-store-fs/src/main/java/org/amdatu/authentication/oauth/consumerregistry/fs/service/FSConsumerRegistryImpl.java
(original)
+++
trunk/amdatu-auth/oauth-stores/consumer-store-fs/src/main/java/org/amdatu/authentication/oauth/consumerregistry/fs/service/FSConsumerRegistryImpl.java
Tue Jul 19 16:40:59 2011
@@ -153,22 +153,6 @@
throw new ConsumerRegistryStorageException(e);
}
}
-
- public OAuthServiceConsumer getConsumerByName(String consumerName) throws
ConsumerRegistryStorageException {
- try {
- List<FSConsumerEntity> consumers = m_storage.getAll();
- for (FSConsumerEntity consumer : consumers) {
- if (consumer.getName().equalsIgnoreCase(consumerName)) {
- return consumer;
- }
- }
- }
- catch (IOException e) {
- throw new ConsumerRegistryStorageException(e);
- }
- return null;
-
- }
public synchronized void addConsumer(final OAuthServiceConsumer consumer)
throws ConsumerAlreadyExistsException,
ConsumerRegistryStorageException {
Modified:
trunk/amdatu-auth/tokenprovider/src/main/java/org/amdatu/authentication/tokenprovider/Token.java
==============================================================================
---
trunk/amdatu-auth/tokenprovider/src/main/java/org/amdatu/authentication/tokenprovider/Token.java
(original)
+++
trunk/amdatu-auth/tokenprovider/src/main/java/org/amdatu/authentication/tokenprovider/Token.java
Tue Jul 19 16:40:59 2011
@@ -117,6 +117,10 @@
}
return m_properties.get(key);
}
+
+ public void setProperties(Map<String, String> properties) {
+ m_properties = properties;
+ }
public void setProperty(String key, String value) {
if (m_properties == null) {
_______________________________________________
Amdatu-commits mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-commits