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 org.springframework.security.oauth.common.signature.SignatureSecret;
20
21 import java.util.Map;
22
23 /**
24 * Details about a protected resource.
25 *
26 * @author Ryan Heaton
27 * @author Andrew McCall
28 */
29 public interface ProtectedResourceDetails {
30
31 /**
32 * An identifier for these resource details.
33 *
34 * @return An identifier for these resource details.
35 */
36 String getId();
37
38 /**
39 * The consumer key with which to interact with the provider.
40 *
41 * @return The consumer key with which to interact with the provider.
42 */
43 String getConsumerKey();
44
45 /**
46 * The signature method to use for OAuth requests.
47 *
48 * @return The signature method to use for OAuth requests.
49 */
50 String getSignatureMethod();
51
52 /**
53 * The shared signature secret.
54 *
55 * @return The shared signature secret.
56 */
57 SignatureSecret getSharedSecret();
58
59 /**
60 * The URL to use to obtain an OAuth request token.
61 *
62 * @return The URL to use to obtain an OAuth request token.
63 */
64 String getRequestTokenURL();
65
66 /**
67 * The HTTP method to use with getRequestTokenURL()
68 *
69 * @return the HTTP method to use with getRequestTokenURL()
70 */
71 String getRequestTokenHttpMethod();
72
73 /**
74 * The URL to which to redirect the user for authorization of access to the protected resource.
75 *
76 * @return The URL to which to redirect the user for authorization of access to the protected resource.
77 */
78 String getUserAuthorizationURL();
79
80 /**
81 * The URL to use to obtain an OAuth access token.
82 *
83 * @return The URL to use to obtain an OAuth access token.
84 */
85 String getAccessTokenURL();
86
87 /**
88 * The HTTP method to use with getAccessTokenURL()
89 *
90 * @return the HTTP method to use with getAccessTokenURL()
91 */
92 String getAccessTokenHttpMethod();
93
94 /**
95 * Whether the provider of this resource accepts the OAuth Authorization HTTP header. Default: true.
96 *
97 * @return Whether the provider of this resource accepts the OAuth Authorization HTTP header.
98 */
99 boolean isAcceptsAuthorizationHeader();
100
101 /**
102 * The value of the realm of the authorization header, or null if none.
103 *
104 * @return The value of the realm of the authorization header
105 */
106 String getAuthorizationHeaderRealm();
107
108 /**
109 * Whether to use OAuth Core 1.0a.
110 *
111 * @return Whether to use OAuth Core 1.0a.
112 */
113 boolean isUse10a();
114
115 /**
116 * The additional OAuth parameters for this protected resource.
117 *
118 * @return The additional OAuth parameters for this protected resource, or null if none.
119 */
120 Map<String, String> getAdditionalParameters();
121
122 /**
123 * The additional request headers to send.
124 *
125 * @return The additional request headers to send.
126 */
127 Map<String, String> getAdditionalRequestHeaders();
128 }