Changeset 6849 in josm for trunk/src/oauth/signpost/AbstractOAuthConsumer.java
- Timestamp:
- 2014-02-13T21:10:18+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oauth/signpost/AbstractOAuthConsumer.java
r4231 r6849 34 34 * ABC for consumer implementations. If you're developing a custom consumer you 35 35 * will probably inherit from this class to save you a lot of work. 36 * 36 * 37 37 * @author Matthias Kaeppler 38 38 */ … … 55 55 // these are the params which will be passed to the message signer 56 56 private HttpParameters requestParameters; 57 57 58 58 private boolean sendEmptyTokens; 59 60 final private Random random = new Random(System.nanoTime()); 59 61 60 62 public AbstractOAuthConsumer(String consumerKey, String consumerSecret) { … … 78 80 } 79 81 80 public HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException, 82 public synchronized HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException, 81 83 OAuthExpectationFailedException, OAuthCommunicationException { 82 84 if (consumerKey == null) { … … 109 111 110 112 signingStrategy.writeSignature(signature, request, requestParameters); 111 OAuth.debugOut("Auth header", request.getHeader("Authorization"));112 113 OAuth.debugOut("Request URL", request.getRequestUrl()); 113 114 … … 115 116 } 116 117 117 public HttpRequest sign(Object request) throws OAuthMessageSignerException, 118 public synchronized HttpRequest sign(Object request) throws OAuthMessageSignerException, 118 119 OAuthExpectationFailedException, OAuthCommunicationException { 119 120 return sign(wrap(request)); 120 121 } 121 122 122 public String sign(String url) throws OAuthMessageSignerException, 123 public synchronized String sign(String url) throws OAuthMessageSignerException, 123 124 OAuthExpectationFailedException, OAuthCommunicationException { 124 125 HttpRequest request = new UrlStringRequestAdapter(url); … … 139 140 * Adapts the given request object to a Signpost {@link HttpRequest}. How 140 141 * this is done depends on the consumer implementation. 141 * 142 * 142 143 * @param request 143 144 * the native HTTP request instance … … 179 180 * {@link #generateNonce()} or {@link #generateTimestamp()} instead. 180 181 * </p> 181 * 182 * 182 183 * @param out 183 184 * the request parameter which should be completed … … 257 258 258 259 protected String generateNonce() { 259 return Long.toString( new Random().nextLong());260 return Long.toString(random.nextLong()); 260 261 } 261 262 }
Note:
See TracChangeset
for help on using the changeset viewer.
