for (String param : request.getParameterNames()) { if (!param.startsWith("oauth_")) { continue; List<String> values = request.getParameterValues(param); if (values == null) { continue; List<String> headers = request.getHeaderValues(AUTHORIZATION_HEADER); if (headers == null) { return this;
/** * Assembles request base string for which a digital signature is to be * generated/verified, per section 9.1.3 of the OAuth 1.0 specification. * * @param request the request from which to assemble baseString. * @param params the OAuth authorization parameters from which to assemble baseString. * @return the concatenated baseString, ready to sign/verify */ private String baseString(final OAuth1Request request, final OAuth1Parameters params) throws OAuth1SignatureException { // HTTP request method final StringBuilder builder = new StringBuilder(request.getRequestMethod().toUpperCase()); // request URL, see section 3.4.1.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.2 builder.append('&').append(UriComponent.encode(constructRequestURL(request).toASCIIString(), UriComponent.Type.UNRESERVED)); // normalized request parameters, see section 3.4.1.3.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.3.2 builder.append('&').append(UriComponent.encode(normalizeParameters(request, params), UriComponent.Type.UNRESERVED)); return builder.toString(); }
/** * Constructs the request URI, per section 9.1.2 of the OAuth 1.0 * specification. * * @param request the incoming request to construct the URI from. * @return the constructed URI. */ private URI constructRequestURL(final OAuth1Request request) throws OAuth1SignatureException { try { final URL url = request.getRequestURL(); if (url == null) { throw new OAuth1SignatureException(); } final StringBuilder builder = new StringBuilder(url.getProtocol()).append("://").append(url.getHost().toLowerCase()); final int port = url.getPort(); if (port > 0 && port != url.getDefaultPort()) { builder.append(':').append(port); } builder.append(url.getPath()); return new URI(builder.toString()); } catch (final URISyntaxException mue) { throw new OAuth1SignatureException(mue); } }
for (final String key : request.getParameterNames()) { final List<String> values = request.getParameterValues(key);
/** * Writes the OAuth parameters to a request, as an Authorization header. * * @param request the request to write OAuth parameters to. * @return this parameters object. */ public OAuth1Parameters writeRequest(OAuth1Request request) { StringBuilder buf = new StringBuilder(SCHEME); boolean comma = false; for (String key : keySet()) { String value = get(key); if (value == null) { continue; } buf.append(comma ? ", " : " ").append(UriComponent.encode(key, UriComponent.Type.UNRESERVED)); buf.append("=\"").append(UriComponent.encode(value, UriComponent.Type.UNRESERVED)).append('"'); comma = true; } request.addHeaderValue(AUTHORIZATION_HEADER, buf.toString()); return this; }
for (final String key : request.getParameterNames()) { final List<String> values = request.getParameterValues(key);
/** * Writes the OAuth parameters to a request, as an Authorization header. * * @param request the request to write OAuth parameters to. * @return this parameters object. */ public OAuth1Parameters writeRequest(OAuth1Request request) { StringBuilder buf = new StringBuilder(SCHEME); boolean comma = false; for (String key : keySet()) { String value = get(key); if (value == null) { continue; } buf.append(comma ? ", " : " ").append(UriComponent.encode(key, UriComponent.Type.UNRESERVED)); buf.append("=\"").append(UriComponent.encode(value, UriComponent.Type.UNRESERVED)).append('"'); comma = true; } request.addHeaderValue(AUTHORIZATION_HEADER, buf.toString()); return this; }
for (String param : request.getParameterNames()) { if (!param.startsWith("oauth_")) { continue; List<String> values = request.getParameterValues(param); if (values == null) { continue; List<String> headers = request.getHeaderValues(AUTHORIZATION_HEADER); if (headers == null) { return this;
for (final String key : request.getParameterNames()) { final List<String> values = request.getParameterValues(key);
private String baseString(final OAuth1Request request, final OAuth1Parameters params) throws OAuth1SignatureException { // HTTP request method final StringBuilder builder = new StringBuilder(request.getRequestMethod().toUpperCase()); // request URL, see section 3.4.1.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.2 builder.append('&').append(UriComponent.encode(constructRequestURL(request).toASCIIString(), UriComponent.Type.UNRESERVED)); // normalized request parameters, see section 3.4.1.3.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.3.2 builder.append('&').append(UriComponent.encode(normalizeParameters(request, params), UriComponent.Type.UNRESERVED)); return builder.toString(); }
private URI constructRequestURL(final OAuth1Request request) throws OAuth1SignatureException { try { final URL url = request.getRequestURL(); if (url == null) { throw new OAuth1SignatureException(); } final StringBuilder builder = new StringBuilder(url.getProtocol()).append("://").append(url.getHost().toLowerCase()); final int port = url.getPort(); if (port > 0 && port != url.getDefaultPort()) { builder.append(':').append(port); } builder.append(url.getPath()); return new URI(builder.toString()); } catch (final URISyntaxException mue) { throw new OAuth1SignatureException(mue); } }
/** * Writes the OAuth parameters to a request, as an Authorization header. * * @param request the request to write OAuth parameters to. * @return this parameters object. */ public OAuth1Parameters writeRequest(OAuth1Request request) { StringBuilder buf = new StringBuilder(SCHEME); boolean comma = false; for (String key : keySet()) { String value = get(key); if (value == null) { continue; } buf.append(comma ? ", " : " ").append(UriComponent.encode(key, UriComponent.Type.UNRESERVED)); buf.append("=\"").append(UriComponent.encode(value, UriComponent.Type.UNRESERVED)).append('"'); comma = true; } request.addHeaderValue(AUTHORIZATION_HEADER, buf.toString()); return this; }
for (String param : request.getParameterNames()) { if (!param.startsWith("oauth_")) { continue; List<String> values = request.getParameterValues(param); if (values == null) { continue; List<String> headers = request.getHeaderValues(AUTHORIZATION_HEADER); if (headers == null) { return this;
for (final String key : request.getParameterNames()) { final List<String> values = request.getParameterValues(key);
/** * Assembles request base string for which a digital signature is to be * generated/verified, per section 9.1.3 of the OAuth 1.0 specification. * * @param request the request from which to assemble baseString. * @param params the OAuth authorization parameters from which to assemble baseString. * @return the concatenated baseString, ready to sign/verify */ private String baseString(final OAuth1Request request, final OAuth1Parameters params) throws OAuth1SignatureException { // HTTP request method final StringBuilder builder = new StringBuilder(request.getRequestMethod().toUpperCase()); // request URL, see section 3.4.1.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.2 builder.append('&').append(UriComponent.encode(constructRequestURL(request).toASCIIString(), UriComponent.Type.UNRESERVED)); // normalized request parameters, see section 3.4.1.3.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.3.2 builder.append('&').append(UriComponent.encode(normalizeParameters(request, params), UriComponent.Type.UNRESERVED)); return builder.toString(); }
/** * Constructs the request URI, per section 9.1.2 of the OAuth 1.0 * specification. * * @param request the incoming request to construct the URI from. * @return the constructed URI. */ private URI constructRequestURL(final OAuth1Request request) throws OAuth1SignatureException { try { final URL url = request.getRequestURL(); if (url == null) { throw new OAuth1SignatureException(); } final StringBuilder builder = new StringBuilder(url.getProtocol()).append("://").append(url.getHost().toLowerCase()); final int port = url.getPort(); if (port > 0 && port != url.getDefaultPort()) { builder.append(':').append(port); } builder.append(url.getPath()); return new URI(builder.toString()); } catch (final URISyntaxException mue) { throw new OAuth1SignatureException(mue); } }
/** * Assembles request base string for which a digital signature is to be * generated/verified, per section 9.1.3 of the OAuth 1.0 specification. * * @param request the request from which to assemble baseString. * @param params the OAuth authorization parameters from which to assemble baseString. * @return the concatenated baseString, ready to sign/verify */ private String baseString(final OAuth1Request request, final OAuth1Parameters params) throws OAuth1SignatureException { // HTTP request method final StringBuilder builder = new StringBuilder(request.getRequestMethod().toUpperCase()); // request URL, see section 3.4.1.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.2 builder.append('&').append(UriComponent.encode(constructRequestURL(request).toASCIIString(), UriComponent.Type.UNRESERVED)); // normalized request parameters, see section 3.4.1.3.2 http://tools.ietf.org/html/draft-hammer-oauth-10#section-3.4.1.3.2 builder.append('&').append(UriComponent.encode(normalizeParameters(request, params), UriComponent.Type.UNRESERVED)); return builder.toString(); }
/** * Constructs the request URI, per section 9.1.2 of the OAuth 1.0 * specification. * * @param request the incoming request to construct the URI from. * @return the constructed URI. */ private URI constructRequestURL(final OAuth1Request request) throws OAuth1SignatureException { try { final URL url = request.getRequestURL(); if (url == null) { throw new OAuth1SignatureException(); } final StringBuilder builder = new StringBuilder(url.getProtocol()).append("://").append(url.getHost().toLowerCase()); final int port = url.getPort(); if (port > 0 && port != url.getDefaultPort()) { builder.append(':').append(port); } builder.append(url.getPath()); return new URI(builder.toString()); } catch (final URISyntaxException mue) { throw new OAuth1SignatureException(mue); } }