Search in sources :

Example 1 with OAuth1SignatureType

use of com.github.scribejava.core.builder.api.OAuth1SignatureType in project scribejava by scribejava.

the class OAuth10aService method appendSignature.

protected void appendSignature(OAuthRequest request) {
    final OAuthConfig config = getConfig();
    final OAuth1SignatureType signatureType = api.getSignatureType();
    switch(signatureType) {
        case Header:
            config.log("using Http Header signature");
            final String oauthHeader = api.getHeaderExtractor().extract(request);
            request.addHeader(OAuthConstants.HEADER, oauthHeader);
            break;
        case QueryString:
            config.log("using Querystring signature");
            for (Map.Entry<String, String> oauthParameter : request.getOauthParameters().entrySet()) {
                request.addQuerystringParameter(oauthParameter.getKey(), oauthParameter.getValue());
            }
            break;
        default:
            throw new IllegalStateException("Unknown new Signature Type '" + signatureType + "'.");
    }
}
Also used : OAuth1SignatureType(com.github.scribejava.core.builder.api.OAuth1SignatureType) OAuthConfig(com.github.scribejava.core.model.OAuthConfig) Map(java.util.Map)

Aggregations

OAuth1SignatureType (com.github.scribejava.core.builder.api.OAuth1SignatureType)1 OAuthConfig (com.github.scribejava.core.model.OAuthConfig)1 Map (java.util.Map)1