Ignore:
Timestamp:
2014-02-13T21:10:18+01:00 (12 years ago)
Author:
stoecker
Message:

see #9710 - update oauth library code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/oauth/signpost/AbstractOAuthConsumer.java

    r4231 r6849  
    3434 * ABC for consumer implementations. If you're developing a custom consumer you
    3535 * will probably inherit from this class to save you a lot of work.
    36  * 
     36 *
    3737 * @author Matthias Kaeppler
    3838 */
     
    5555    // these are the params which will be passed to the message signer
    5656    private HttpParameters requestParameters;
    57 
     57   
    5858    private boolean sendEmptyTokens;
     59   
     60    final private Random random = new Random(System.nanoTime());
    5961
    6062    public AbstractOAuthConsumer(String consumerKey, String consumerSecret) {
     
    7880    }
    7981
    80     public HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException,
     82    public synchronized HttpRequest sign(HttpRequest request) throws OAuthMessageSignerException,
    8183            OAuthExpectationFailedException, OAuthCommunicationException {
    8284        if (consumerKey == null) {
     
    109111
    110112        signingStrategy.writeSignature(signature, request, requestParameters);
    111         OAuth.debugOut("Auth header", request.getHeader("Authorization"));
    112113        OAuth.debugOut("Request URL", request.getRequestUrl());
    113114
     
    115116    }
    116117
    117     public HttpRequest sign(Object request) throws OAuthMessageSignerException,
     118    public synchronized HttpRequest sign(Object request) throws OAuthMessageSignerException,
    118119            OAuthExpectationFailedException, OAuthCommunicationException {
    119120        return sign(wrap(request));
    120121    }
    121122
    122     public String sign(String url) throws OAuthMessageSignerException,
     123    public synchronized String sign(String url) throws OAuthMessageSignerException,
    123124            OAuthExpectationFailedException, OAuthCommunicationException {
    124125        HttpRequest request = new UrlStringRequestAdapter(url);
     
    139140     * Adapts the given request object to a Signpost {@link HttpRequest}. How
    140141     * this is done depends on the consumer implementation.
    141      * 
     142     *
    142143     * @param request
    143144     *        the native HTTP request instance
     
    179180     * {@link #generateNonce()} or {@link #generateTimestamp()} instead.
    180181     * </p>
    181      * 
     182     *
    182183     * @param out
    183184     *        the request parameter which should be completed
     
    257258
    258259    protected String generateNonce() {
    259         return Long.toString(new Random().nextLong());
     260        return Long.toString(random.nextLong());
    260261    }
    261262}
Note: See TracChangeset for help on using the changeset viewer.