private Form getAuthorizationResult(OAuthAuthorizationData data) { Form form = new Form(); form.param("client_id", data.getClientId()); form.param("state", data.getState()); form.param("scope", data.getProposedScope()); form.param("redirect_uri", data.getRedirectUri()); // TODO: get the user confirmation, using a popup window or a blocking cmd input form.param("oauthDecision", "allow"); form.param("session_authenticity_token", data.getAuthenticityToken()); return form; }
OAuthAuthorizationData secData = new OAuthAuthorizationData(); secData.setState(params.getFirst(OAuthConstants.STATE)); secData.setRedirectUri(redirectUri); secData.setAudience(params.getFirst(OAuthConstants.CLIENT_AUDIENCE)); secData.setNonce(params.getFirst(OAuthConstants.NONCE)); secData.setClientId(client.getClientId()); secData.setResponseType(params.getFirst(OAuthConstants.RESPONSE_TYPE)); if (requestedPerms != null && !requestedPerms.isEmpty()) { StringBuilder builder = new StringBuilder(); secData.setProposedScope(builder.toString().trim()); secData.setPermissions(requestedPerms); secData.setAlreadyAuthorizedPermissions(alreadyAuthorizedPerms); secData.setHidePreauthorizedScopesInForm(hidePreauthorizedScopesInForm); secData.setApplicationName(client.getApplicationName()); secData.setApplicationWebUri(client.getApplicationWebUri()); secData.setApplicationDescription(client.getApplicationDescription()); secData.setApplicationLogoUri(client.getApplicationLogoUri()); secData.setApplicationCertificates(client.getApplicationCertificates()); Map<String, String> extraProperties = client.getProperties(); secData.setExtraApplicationProperties(extraProperties); secData.setApplicationRegisteredDynamically(client.isRegisteredDynamically()); secData.setSupportSinglePageApplications(supportSinglePageApplications); String replyTo = getMessageContext().getUriInfo() .getAbsolutePathBuilder().path("decision").build().toString(); secData.setReplyTo(replyTo); personalizeData(secData, subject);
public List<OAuthPermission> getAllPermissions() { List<OAuthPermission> allPerms = new LinkedList<>(); if (alreadyAuthorizedPermissions != null) { allPerms.addAll(alreadyAuthorizedPermissions); if (permissions != null) { List<String> list = getAlreadyAuthorizedPermissionsAsStrings(); for (OAuthPermission perm : permissions) { if (!list.contains(perm.getPermission())) { allPerms.add(perm); } } } } else if (permissions != null) { allPerms.addAll(permissions); } return allPerms; }
public static String getLocation(WebClient client, OAuthAuthorizationData authzData, String state) { // Now call "decision" to get the authorization code grant client.path("decision"); client.type("application/x-www-form-urlencoded"); Form form = new Form(); form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce()); } if (authzData.getProposedScope() != null) { form.param("scope", authzData.getProposedScope()); } if (authzData.getState() != null) { form.param("state", authzData.getState()); } form.param("response_type", authzData.getResponseType()); form.param("oauthDecision", "allow"); Response response = client.post(form); String location = response.getHeaderString("Location"); if (state != null) { Assert.assertTrue(location.contains("state=" + state)); } return location; }
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("oauthDecision", "allow");
authorizeClient.to(data.getReplyTo(), false); if (authenticityCookie != null) { authorizeClient.header("Cookie", (String)authenticityCookie);
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("scope", authzData.getProposedScope()); if (authzData.getResponseType() != null) { form.param("response_type", authzData.getResponseType()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce());
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("scope", authzData.getProposedScope()); if (authzData.getResponseType() != null) { form.param("response_type", authzData.getResponseType()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce());
OAuthAuthorizationData secData = new OAuthAuthorizationData(); secData.setState(params.getFirst(OAuthConstants.STATE)); secData.setRedirectUri(redirectUri); secData.setAudience(params.getFirst(OAuthConstants.CLIENT_AUDIENCE)); secData.setNonce(params.getFirst(OAuthConstants.NONCE)); secData.setClientId(client.getClientId()); secData.setResponseType(params.getFirst(OAuthConstants.RESPONSE_TYPE)); if (requestedPerms != null && !requestedPerms.isEmpty()) { StringBuilder builder = new StringBuilder(); secData.setProposedScope(builder.toString().trim()); secData.setPermissions(requestedPerms); secData.setAlreadyAuthorizedPermissions(alreadyAuthorizedPerms); secData.setHidePreauthorizedScopesInForm(hidePreauthorizedScopesInForm); secData.setApplicationName(client.getApplicationName()); secData.setApplicationWebUri(client.getApplicationWebUri()); secData.setApplicationDescription(client.getApplicationDescription()); secData.setApplicationLogoUri(client.getApplicationLogoUri()); secData.setApplicationCertificates(client.getApplicationCertificates()); Map<String, String> extraProperties = client.getProperties(); secData.setExtraApplicationProperties(extraProperties); secData.setApplicationRegisteredDynamically(client.isRegisteredDynamically()); secData.setSupportSinglePageApplications(supportSinglePageApplications); String replyTo = getMessageContext().getUriInfo() .getAbsolutePathBuilder().path("decision").build().toString(); secData.setReplyTo(replyTo); personalizeData(secData, subject);
private String makeAuthorizationCodeInvocation(WebClient client) { // Make initial authorization request client.type("application/json").accept("application/json"); Response response = client.get(); OAuthAuthorizationData authzData = response.readEntity(OAuthAuthorizationData.class); // Now call "decision" to get the authorization code grant client.path("decision"); client.type("application/x-www-form-urlencoded"); Form form = new Form(); form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); if (authzData.getProposedScope() != null) { form.param("scope", authzData.getProposedScope()); } form.param("state", authzData.getState()); form.param("oauthDecision", "allow"); response = client.post(form); return response.getHeaderString("Location"); }
public List<OAuthPermission> getAllPermissions() { List<OAuthPermission> allPerms = new LinkedList<>(); if (alreadyAuthorizedPermissions != null) { allPerms.addAll(alreadyAuthorizedPermissions); if (permissions != null) { List<String> list = getAlreadyAuthorizedPermissionsAsStrings(); for (OAuthPermission perm : permissions) { if (!list.contains(perm.getPermission())) { allPerms.add(perm); } } } } else if (permissions != null) { allPerms.addAll(permissions); } return allPerms; }
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("scope", authzData.getProposedScope()); if (authzData.getResponseType() != null) { form.param("response_type", authzData.getResponseType()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce());
private String getLocationUsingAuthorizationCodeGrant(WebClient client) { client.type("application/json").accept("application/json"); Response response = client.get(); OAuthAuthorizationData authzData = response.readEntity(OAuthAuthorizationData.class); // Now call "decision" to get the authorization code grant client.path("decision"); client.type("application/x-www-form-urlencoded"); Form form = new Form(); form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); if (authzData.getProposedScope() != null) { form.param("scope", authzData.getProposedScope()); } form.param("state", authzData.getState()); form.param("oauthDecision", "allow"); response = client.post(form); return response.getHeaderString("Location"); }
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("scope", authzData.getProposedScope()); if (authzData.getResponseType() != null) { form.param("response_type", authzData.getResponseType()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce());
form.param("session_authenticity_token", authzData.getAuthenticityToken()); form.param("client_id", authzData.getClientId()); form.param("redirect_uri", authzData.getRedirectUri()); form.param("scope", authzData.getProposedScope()); if (authzData.getResponseType() != null) { form.param("response_type", authzData.getResponseType()); if (authzData.getNonce() != null) { form.param("nonce", authzData.getNonce());