Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package ru.hh.oauth.subscribe.apis.service;
 
 import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
    public OdnoklassnikiServiceImpl(final DefaultApi20 apifinal OAuthConfig config) {
        super(apiconfig);
    }
    @Override
    public void signRequest(final Token accessTokenfinal AbstractRequest request) {
        // sig = md5( request_params_composed_string+ md5(access_token + application_secret_key)  )
        try {
            final String tokenDigest = md5Hex((accessToken.getToken() + getConfig().getApiSecret()));
            final String completeUrl = request.getCompleteUrl();
            final int queryIndex = completeUrl.indexOf('?');
            if (queryIndex != -1) {
                final String sigSource = URLDecoder.decode(completeUrl.substring(queryIndex + 1).replace("&"""), .) + tokenDigest;
                request.addQuerystringParameter("sig"md5Hex(sigSource));
            }
            super.signRequest(accessTokenrequest);
        } catch (UnsupportedEncodingException unex) {
            throw new IllegalStateException(unex);
        }
    }
New to GrepCode? Check out our FAQ X