Java Code Examples for net.oauth.OAuth#Parameter
The following examples show how to use
net.oauth.OAuth#Parameter .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpRequestMessage.java From lams with GNU General Public License v2.0 | 6 votes |
public static List<OAuth.Parameter> getParameters(HttpServletRequest request) { List<OAuth.Parameter> list = new ArrayList<OAuth.Parameter>(); for (Enumeration<String> headers = request.getHeaders("Authorization"); headers != null && headers.hasMoreElements();) { String header = headers.nextElement(); for (OAuth.Parameter parameter : OAuthMessage .decodeAuthorization(header)) { if (!"realm".equalsIgnoreCase(parameter.getKey())) { list.add(parameter); } } } for (Object e : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) e; String name = entry.getKey(); for (String value : entry.getValue()) { list.add(new OAuth.Parameter(name, value)); } } return list; }
Example 2
Source File: HttpRequestMessage.java From sakai with Educational Community License v2.0 | 6 votes |
@SuppressWarnings("unchecked") public static List<OAuth.Parameter> getParameters(HttpServletRequest request) { List<OAuth.Parameter> list = new ArrayList<OAuth.Parameter>(); for (Enumeration<String> headers = request.getHeaders("Authorization"); headers != null && headers.hasMoreElements();) { String header = headers.nextElement(); for (OAuth.Parameter parameter : OAuthMessage .decodeAuthorization(header)) { if (!"realm".equalsIgnoreCase(parameter.getKey())) { list.add(parameter); } } } for (Object e : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) e; String name = entry.getKey(); for (String value : entry.getValue()) { list.add(new OAuth.Parameter(name, value)); } } return list; }
Example 3
Source File: HttpRequestMessage.java From sakai with Educational Community License v2.0 | 6 votes |
@SuppressWarnings("unchecked") public static List<OAuth.Parameter> getParameters(HttpServletRequest request) { List<OAuth.Parameter> list = new ArrayList<OAuth.Parameter>(); for (Enumeration<String> headers = request.getHeaders("Authorization"); headers != null && headers.hasMoreElements();) { String header = headers.nextElement(); for (OAuth.Parameter parameter : OAuthMessage .decodeAuthorization(header)) { if (!"realm".equalsIgnoreCase(parameter.getKey())) { list.add(parameter); } } } for (Object e : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) e; String name = entry.getKey(); for (String value : entry.getValue()) { list.add(new OAuth.Parameter(name, value)); } } return list; }
Example 4
Source File: GoogleOAuthSubmitter.java From jivejdon with Apache License 2.0 | 5 votes |
public OAuthAccessor request(String backUrl) { OAuthConsumer consumer = new OAuthConsumer(backUrl, goolgeOAuthParamVO.CONSUMER_KEY, goolgeOAuthParamVO.CONSUMER_SECRET, goolgeOAuthParamVO.oAuthServiceProvider); OAuthAccessor accessor = new OAuthAccessor(consumer); try { List<OAuth.Parameter> parameters = OAuth.newList(OAuth.OAUTH_CALLBACK, backUrl); parameters.add(new OAuth.Parameter("scope", goolgeOAuthParamVO.scope)); CLIENT.getRequestTokenResponse(accessor, null, parameters); } catch (Exception e) { logger.error("request error:" + e); } return accessor; }
Example 5
Source File: GoogleOAuthSubmitter.java From jivejdon with Apache License 2.0 | 5 votes |
public OAuthAccessor requstAccessToken(OAuthAccessor accessor, String oauthVerifier) throws Exception { OAuthMessage result = null; try { List<OAuth.Parameter> parameters = OAuth.newList(OAuth.OAUTH_VERIFIER, oauthVerifier); result = CLIENT.getAccessToken(accessor, null, parameters); } catch (Exception e) { OAuthProblemException problem = new OAuthProblemException(OAuth.Problems.PARAMETER_ABSENT); problem.setParameter(OAuth.Problems.OAUTH_PARAMETERS_ABSENT, OAuth.OAUTH_TOKEN); problem.getParameters().putAll(result.getDump()); logger.error("request error:" + problem.getMessage()); throw problem; } return accessor; }
Example 6
Source File: OAuthResponseMessage.java From sakai with Educational Community License v2.0 | 5 votes |
OAuthResponseMessage(HttpResponseMessage http) throws IOException { super(http.method, http.url.toExternalForm(), null); this.http = http; getHeaders().addAll(http.headers); for (Map.Entry<String, String> header : http.headers) { if ("WWW-Authenticate".equalsIgnoreCase(header.getKey())) { for (OAuth.Parameter parameter : decodeAuthorization(header.getValue())) { if (!"realm".equalsIgnoreCase(parameter.getKey())) { addParameter(parameter); } } } } }
Example 7
Source File: OAuthResponseMessage.java From sakai with Educational Community License v2.0 | 5 votes |
OAuthResponseMessage(HttpResponseMessage http) throws IOException { super(http.method, http.url.toExternalForm(), null); this.http = http; getHeaders().addAll(http.headers); for (Map.Entry<String, String> header : http.headers) { if ("WWW-Authenticate".equalsIgnoreCase(header.getKey())) { for (OAuth.Parameter parameter : decodeAuthorization(header.getValue())) { if (!"realm".equalsIgnoreCase(parameter.getKey())) { addParameter(parameter); } } } } }
Example 8
Source File: OAuthTestUtils.java From cxf with Apache License 2.0 | 5 votes |
public static OAuth.Parameter findOAuthParameter(List<OAuth.Parameter> list, String key) { for (OAuth.Parameter parameter : list) { if (key.equals(parameter.getKey())) { return parameter; } } return null; }
Example 9
Source File: OAuthTestUtils.java From cxf with Apache License 2.0 | 4 votes |
public static List<OAuth.Parameter> getResponseParams(OAuthMessage message) throws IOException { String body = OAuthTestUtils.readBody(message); return OAuth.decodeForm(body); }