1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.security.oauth.provider;
18
19 import org.springframework.security.oauth.common.OAuthException;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24
25
26
27
28
29 public class InMemoryConsumerDetailsService implements ConsumerDetailsService {
30
31 private Map<String, ? extends ConsumerDetails> consumerDetailsStore = new HashMap<String, ConsumerDetails>();
32
33 public ConsumerDetails loadConsumerByConsumerKey(String consumerKey) throws OAuthException {
34 ConsumerDetails details = consumerDetailsStore.get(consumerKey);
35 if (details == null) {
36 throw new InvalidOAuthParametersException("Consumer not found: " + consumerKey);
37 }
38 return details;
39 }
40
41 public Map<String, ? extends ConsumerDetails> getConsumerDetailsStore() {
42 return consumerDetailsStore;
43 }
44
45 public void setConsumerDetailsStore(Map<String, ? extends ConsumerDetails> consumerDetailsStore) {
46 this.consumerDetailsStore = consumerDetailsStore;
47 }
48 }