diff --git a/core/src/main/java/org/keycloak/AbstractOAuthClient.java b/core/src/main/java/org/keycloak/AbstractOAuthClient.java
index bf40101188..955f9df1b0 100755
--- a/core/src/main/java/org/keycloak/AbstractOAuthClient.java
+++ b/core/src/main/java/org/keycloak/AbstractOAuthClient.java
@@ -28,6 +28,7 @@ public class AbstractOAuthClient {
protected String codeUrl;
protected String stateCookieName = "OAuth_Token_Request_State";
protected Client client;
+ protected boolean isSecure;
protected final AtomicLong counter = new AtomicLong();
protected String getStateCode() {
@@ -109,6 +110,8 @@ public class AbstractOAuthClient {
Form codeForm = new Form()
.param("grant_type", "authorization_code")
.param("code", code)
+ .param("client_id", clientId)
+ .param("Password", password)
.param("redirect_uri", redirectUri);
Response res = client.target(codeUrl).request().header(HttpHeaders.AUTHORIZATION, authHeader).post(Entity.form(codeForm));
try {
diff --git a/core/src/main/java/org/keycloak/servlet/ServletOAuthClient.java b/core/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
index 3ba72240d2..27693b40bc 100755
--- a/core/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
+++ b/core/src/main/java/org/keycloak/servlet/ServletOAuthClient.java
@@ -55,7 +55,7 @@ public class ServletOAuthClient extends AbstractOAuthClient {
if (cookiePath.equals("")) cookiePath = "/";
Cookie cookie = new Cookie(stateCookieName, state);
- cookie.setSecure(true);
+ cookie.setSecure(isSecure);
cookie.setPath(cookiePath);
response.addCookie(cookie);
response.sendRedirect(url.toString());
diff --git a/examples/as7-eap-demo/server/src/main/webapp/META-INF/testrealm.json b/examples/as7-eap-demo/server/src/main/webapp/META-INF/testrealm.json
index dc9375a62f..b81aad6353 100755
--- a/examples/as7-eap-demo/server/src/main/webapp/META-INF/testrealm.json
+++ b/examples/as7-eap-demo/server/src/main/webapp/META-INF/testrealm.json
@@ -25,16 +25,34 @@
{ "type" : "Password",
"value" : "password" }
]
+ },
+ {
+ "username" : "third-party",
+ "enabled" : true,
+ "credentials" : [
+ { "type" : "Password",
+ "value" : "password" }
+ ]
}
],
"roles" : [
- { "name" : "user", "description" : "User privileges" },
- { "name" : "admin", "description" : "Administrator privileges" }
+ { "name" : "user", "description" : "Have User privileges" },
+ { "name" : "admin", "description" : "Have Administrator privileges" }
],
"roleMappings" : [
{
"username" : "bburke@redhat.com",
"roles" : ["user"]
+ },
+ {
+ "username" : "third-party",
+ "roles" : ["KEYCLOAK_IDENTITY_REQUESTER"]
+ }
+ ],
+ "scopeMappings" : [
+ {
+ "username" : "third-party",
+ "roles" : ["user"]
}
],
"resources" : [
diff --git a/examples/as7-eap-demo/server/src/main/webapp/loginForm.jsp b/examples/as7-eap-demo/server/src/main/webapp/loginForm.jsp
index b3ee74af4d..0e1b963918 100755
--- a/examples/as7-eap-demo/server/src/main/webapp/loginForm.jsp
+++ b/examples/as7-eap-demo/server/src/main/webapp/loginForm.jsp
@@ -9,7 +9,7 @@
- Keycloak
+ Keycloak Realm Login Page
diff --git a/examples/as7-eap-demo/server/src/main/webapp/oauthGrantForm.jsp b/examples/as7-eap-demo/server/src/main/webapp/oauthGrantForm.jsp
new file mode 100755
index 0000000000..07c1d7e520
--- /dev/null
+++ b/examples/as7-eap-demo/server/src/main/webapp/oauthGrantForm.jsp
@@ -0,0 +1,82 @@
+<%@ page import="org.picketlink.idm.model.*,org.keycloak.services.models.*,org.keycloak.services.resources.*,javax.ws.rs.core.*,java.util.*" language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%
+ RealmModel realm = (RealmModel)request.getAttribute(RealmModel.class.getName());
+ String username = (String)request.getAttribute("username");
+%>
+
+
+
+
+
+ Keycloak
+
+
+
+
+
+
+
+
+
+
+
+<%
+ User client = (User)request.getAttribute("client");
+ List realmRolesRequested = (List)request.getAttribute("realmRolesRequested");
+ MultivaluedMap resourceRolesRequested = (MultivaluedMap)request.getAttribute("resourceRolesRequested");
+%>
+
+ Grant request for: <%=client.getLoginName()%>
+
+
+
+
This app would like to:
+
+ <%
+ if (realmRolesRequested.size() > 0) {
+ %>
<%
+ for (Role role : realmRolesRequested) {
+ String desc = "Have " + role.getName() + " privileges.";
+ Attribute roleDesc = role.getAttribute("description");
+ if (roleDesc != null) {
+ desc = (String)roleDesc.getValue();
+ }
+ %>
+ - <%=desc%>
+ <%
+ }
+ %>
<%
+ }
+ for (String resource : resourceRolesRequested.keySet()) {
+ List
roles = resourceRolesRequested.get(resource);
+ out.println("For application " + resource + ": ");
+ out.println("");
+ for (Role role : roles) {
+ String desc = "Have " + role.getName() + " privileges.";
+ Attribute roleDesc = role.getAttribute("description");
+ if (roleDesc != null) {
+ desc = (String)roleDesc.getValue();
+ }
+ out.println("- " + desc + "
");
+ }
+ out.println("
");
+ }
+ %>
+
+
+
+
+
+