source: josm/trunk/src/oauth/signpost/signature/OAuthMessageSigner.java@ 8149

Last change on this file since 8149 was 8149, checked in by stoecker, 9 years ago

fix #11257 - Remove apache.commons.codecs - patch by Florian Schaefer

File size: 2.0 KB
Line 
1/* Copyright (c) 2009 Matthias Kaeppler
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15package oauth.signpost.signature;
16
17import java.io.IOException;
18import java.io.Serializable;
19import javax.xml.bind.DatatypeConverter;
20
21import oauth.signpost.exception.OAuthMessageSignerException;
22import oauth.signpost.http.HttpRequest;
23import oauth.signpost.http.HttpParameters;
24
25public abstract class OAuthMessageSigner implements Serializable {
26
27 private static final long serialVersionUID = 4445779788786131202L;
28
29 private String consumerSecret;
30
31 private String tokenSecret;
32
33
34 public abstract String sign(HttpRequest request, HttpParameters requestParameters)
35 throws OAuthMessageSignerException;
36
37 public abstract String getSignatureMethod();
38
39 public String getConsumerSecret() {
40 return consumerSecret;
41 }
42
43 public String getTokenSecret() {
44 return tokenSecret;
45 }
46
47 public void setConsumerSecret(String consumerSecret) {
48 this.consumerSecret = consumerSecret;
49 }
50
51 public void setTokenSecret(String tokenSecret) {
52 this.tokenSecret = tokenSecret;
53 }
54
55 protected byte[] decodeBase64(String s) {
56 return DatatypeConverter.parseBase64Binary(s);
57 }
58
59 protected String base64Encode(byte[] b) {
60 return DatatypeConverter.printBase64Binary(b);
61 }
62
63 private void readObject(java.io.ObjectInputStream stream)
64 throws IOException, ClassNotFoundException {
65 stream.defaultReadObject();
66 }
67}
Note: See TracBrowser for help on using the repository browser.