// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package org.apache.oltu.oauth2.client.request; import java.util.HashMap; import java.util.Map; import org.apache.oltu.oauth2.common.OAuthProviderType; import org.apache.oltu.oauth2.common.exception.OAuthSystemException; import org.apache.oltu.oauth2.common.message.OAuthMessage; import org.apache.oltu.oauth2.common.message.types.GrantType; import org.apache.oltu.oauth2.common.parameters.BodyURLEncodedParametersApplier; import org.apache.oltu.oauth2.common.parameters.OAuthParametersApplier; import org.apache.oltu.oauth2.common.parameters.QueryParameterApplier; // Referenced classes of package org.apache.oltu.oauth2.client.request: // ClientHeaderParametersApplier public class OAuthClientRequest implements OAuthMessage { public static class AuthenticationRequestBuilder extends OAuthRequestBuilder { public AuthenticationRequestBuilder setClientId(String s) { parameters.put("client_id", s); return this; } public AuthenticationRequestBuilder setParameter(String s, String s1) { parameters.put(s, s1); return this; } public AuthenticationRequestBuilder setRedirectURI(String s) { parameters.put("redirect_uri", s); return this; } public AuthenticationRequestBuilder setResponseType(String s) { parameters.put("response_type", s); return this; } public AuthenticationRequestBuilder setScope(String s) { parameters.put("scope", s); return this; } public AuthenticationRequestBuilder setState(String s) { parameters.put("state", s); return this; } public AuthenticationRequestBuilder(String s) { super(s); } } public static abstract class OAuthRequestBuilder { protected OAuthParametersApplier applier; protected Map parameters; protected String url; public OAuthClientRequest buildBodyMessage() throws OAuthSystemException { OAuthClientRequest oauthclientrequest = new OAuthClientRequest(url); applier = new BodyURLEncodedParametersApplier(); return (OAuthClientRequest)applier.applyOAuthParameters(oauthclientrequest, parameters); } public OAuthClientRequest buildHeaderMessage() throws OAuthSystemException { OAuthClientRequest oauthclientrequest = new OAuthClientRequest(url); applier = new ClientHeaderParametersApplier(); return (OAuthClientRequest)applier.applyOAuthParameters(oauthclientrequest, parameters); } public OAuthClientRequest buildQueryMessage() throws OAuthSystemException { OAuthClientRequest oauthclientrequest = new OAuthClientRequest(url); applier = new QueryParameterApplier(); return (OAuthClientRequest)applier.applyOAuthParameters(oauthclientrequest, parameters); } protected OAuthRequestBuilder(String s) { parameters = new HashMap(); url = s; } } public static class TokenRequestBuilder extends OAuthRequestBuilder { public TokenRequestBuilder setAssertion(String s) { parameters.put("assertion", s); return this; } public TokenRequestBuilder setAssertionType(String s) { parameters.put("assertion_type", s); return this; } public TokenRequestBuilder setClientId(String s) { parameters.put("client_id", s); return this; } public TokenRequestBuilder setClientSecret(String s) { parameters.put("client_secret", s); return this; } public TokenRequestBuilder setCode(String s) { parameters.put("code", s); return this; } public TokenRequestBuilder setGrantType(GrantType granttype) { Map map = parameters; if (granttype == null) { granttype = null; } else { granttype = granttype.toString(); } map.put("grant_type", granttype); return this; } public TokenRequestBuilder setParameter(String s, String s1) { parameters.put(s, s1); return this; } public TokenRequestBuilder setPassword(String s) { parameters.put("password", s); return this; } public TokenRequestBuilder setRedirectURI(String s) { parameters.put("redirect_uri", s); return this; } public TokenRequestBuilder setRefreshToken(String s) { parameters.put("refresh_token", s); return this; } public TokenRequestBuilder setScope(String s) { parameters.put("scope", s); return this; } public TokenRequestBuilder setUsername(String s) { parameters.put("username", s); return this; } public TokenRequestBuilder(String s) { super(s); } } protected String body; protected Map headers; protected String url; protected OAuthClientRequest(String s) { url = s; headers = new HashMap(); } public static AuthenticationRequestBuilder authorizationLocation(String s) { return new AuthenticationRequestBuilder(s); } public static AuthenticationRequestBuilder authorizationProvider(OAuthProviderType oauthprovidertype) { return authorizationLocation(oauthprovidertype.getAuthzEndpoint()); } public static TokenRequestBuilder tokenLocation(String s) { return new TokenRequestBuilder(s); } public static TokenRequestBuilder tokenProvider(OAuthProviderType oauthprovidertype) { return tokenLocation(oauthprovidertype.getTokenEndpoint()); } public void addHeader(String s, String s1) { headers.put(s, s1); } public String getBody() { return body; } public String getHeader(String s) { return (String)headers.get(s); } public Map getHeaders() { return headers; } public String getLocationUri() { return url; } public void setBody(String s) { body = s; } public void setHeader(String s, String s1) { headers.put(s, s1); } public void setHeaders(Map map) { headers = map; } public void setLocationUri(String s) { url = s; } }