View Javadoc
1   /*
2    * Copyright 2008 Web Cohesion
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.security.oauth.consumer;
18  
19  import java.util.Map;
20  
21  import org.springframework.security.oauth.common.signature.HMAC_SHA1SignatureMethod;
22  import org.springframework.security.oauth.common.signature.SignatureSecret;
23  
24  /**
25   * Basic implementation of protected resource details.
26   *
27   * @author Ryan Heaton
28   */
29  public class BaseProtectedResourceDetails implements ProtectedResourceDetails {
30  
31    private String id;
32    private String consumerKey;
33  	private String signatureMethod = HMAC_SHA1SignatureMethod.SIGNATURE_NAME;
34    private SignatureSecret sharedSecret;
35    private String requestTokenURL;
36    private String requestTokenHttpMethod = "POST";
37    private String userAuthorizationURL;
38    private String accessTokenURL;
39    private String accessTokenHttpMethod = "POST";
40    private boolean acceptsAuthorizationHeader = true;
41    private String authorizationHeaderRealm;
42    private boolean use10a = true;
43    private Map<String, String> additionalParameters;
44    private Map<String, String> additionalRequestHeaders;
45  
46    public String getId() {
47      return id;
48    }
49  
50    public void setId(String id) {
51      this.id = id;
52    }
53  
54    public String getConsumerKey() {
55      return consumerKey;
56    }
57  
58    public void setConsumerKey(String consumerKey) {
59      this.consumerKey = consumerKey;
60    }
61  
62    public String getSignatureMethod() {
63      return signatureMethod;
64    }
65  
66    public void setSignatureMethod(String signatureMethod) {
67      this.signatureMethod = signatureMethod;
68    }
69  
70    public SignatureSecret getSharedSecret() {
71      return sharedSecret;
72    }
73  
74    public void setSharedSecret(SignatureSecret sharedSecret) {
75      this.sharedSecret = sharedSecret;
76    }
77  
78    public String getRequestTokenURL() {
79      return requestTokenURL;
80    }
81  
82    public void setRequestTokenURL(String requestTokenURL) {
83      this.requestTokenURL = requestTokenURL;
84    }
85  
86    public String getRequestTokenHttpMethod() {
87      return requestTokenHttpMethod;
88    }
89  
90    public void setRequestTokenHttpMethod(String requestTokenHttpMethod) {
91      this.requestTokenHttpMethod = requestTokenHttpMethod;
92    }
93  
94    public String getUserAuthorizationURL() {
95      return userAuthorizationURL;
96    }
97  
98    public void setUserAuthorizationURL(String userAuthorizationURL) {
99      this.userAuthorizationURL = userAuthorizationURL;
100   }
101 
102   public String getAccessTokenURL() {
103     return accessTokenURL;
104   }
105 
106   public void setAccessTokenURL(String accessTokenURL) {
107     this.accessTokenURL = accessTokenURL;
108   }
109 
110   public String getAccessTokenHttpMethod() {
111     return accessTokenHttpMethod;
112   }
113 
114   public void setAccessTokenHttpMethod(String accessTokenHttpMethod) {
115     this.accessTokenHttpMethod = accessTokenHttpMethod;
116   }
117 
118   public boolean isAcceptsAuthorizationHeader() {
119     return acceptsAuthorizationHeader;
120   }
121 
122   public void setAcceptsAuthorizationHeader(boolean acceptsAuthorizationHeader) {
123     this.acceptsAuthorizationHeader = acceptsAuthorizationHeader;
124   }
125 
126   public String getAuthorizationHeaderRealm() {
127     return authorizationHeaderRealm;
128   }
129 
130   public void setAuthorizationHeaderRealm(String authorizationHeaderRealm) {
131     this.authorizationHeaderRealm = authorizationHeaderRealm;
132   }
133 
134   public boolean isUse10a() {
135     return use10a;
136   }
137 
138   public void setUse10a(boolean use10a) {
139     this.use10a = use10a;
140   }
141 
142   public Map<String, String> getAdditionalParameters() {
143     return additionalParameters;
144   }
145 
146   public void setAdditionalParameters(Map<String, String> additionalParameters) {
147     this.additionalParameters = additionalParameters;
148   }
149 
150   public Map<String, String> getAdditionalRequestHeaders() {
151     return additionalRequestHeaders;
152   }
153 
154   public void setAdditionalRequestHeaders(Map<String, String> additionalRequestHeaders) {
155     this.additionalRequestHeaders = additionalRequestHeaders;
156   }
157 }