Moved SocialRequestManager from social/core to services
This commit is contained in:
parent
de6cd5f10a
commit
2ff46353bc
9 changed files with 23 additions and 27 deletions
|
@ -19,7 +19,9 @@
|
|||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||
*/
|
||||
package org.keycloak.social;
|
||||
package org.keycloak.services.managers;
|
||||
|
||||
import org.keycloak.social.RequestDetails;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
|
@ -8,7 +8,7 @@ import org.keycloak.models.picketlink.PicketlinkKeycloakSessionFactory;
|
|||
import org.keycloak.models.picketlink.mappings.ApplicationEntity;
|
||||
import org.keycloak.models.picketlink.mappings.RealmEntity;
|
||||
import org.keycloak.services.utils.PropertiesManager;
|
||||
import org.keycloak.social.SocialRequestManager;
|
||||
import org.keycloak.services.managers.SocialRequestManager;
|
||||
import org.picketlink.idm.PartitionManager;
|
||||
import org.picketlink.idm.config.IdentityConfigurationBuilder;
|
||||
import org.picketlink.idm.internal.DefaultPartitionManager;
|
||||
|
|
|
@ -66,7 +66,7 @@ import org.keycloak.social.SocialConstants;
|
|||
import org.keycloak.social.SocialProvider;
|
||||
import org.keycloak.social.SocialProviderConfig;
|
||||
import org.keycloak.social.SocialProviderException;
|
||||
import org.keycloak.social.SocialRequestManager;
|
||||
import org.keycloak.services.managers.SocialRequestManager;
|
||||
import org.keycloak.social.SocialUser;
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,6 @@ public class SocialResource {
|
|||
MultivaluedMap<String, String> formData = fillRegistrationFormWithSocialData(socialUser);
|
||||
|
||||
RequestDetailsBuilder reqDetailsBuilder = RequestDetailsBuilder.createFromRequestDetails(requestData);
|
||||
reqDetailsBuilder.putSocialAttribute(SocialConstants.ATTR_SOCIAL_LINK, socialLink);
|
||||
|
||||
String requestId = UUID.randomUUID().toString();
|
||||
socialRequestManager.addRequest(requestId, reqDetailsBuilder.build());
|
||||
|
@ -281,7 +280,6 @@ public class SocialResource {
|
|||
String scope = requestData.getClientAttribute("scope");
|
||||
String state = requestData.getClientAttribute("state");
|
||||
String redirectUri = requestData.getClientAttribute("redirectUri");
|
||||
SocialLinkModel socialLink = (SocialLinkModel)requestData.getSocialAttribute(SocialConstants.ATTR_SOCIAL_LINK);
|
||||
|
||||
Response response1 = tokenService.processRegisterImpl(clientId, scope, state, redirectUri, formData, true);
|
||||
|
||||
|
@ -297,7 +295,7 @@ public class SocialResource {
|
|||
// Normally shouldn't happen
|
||||
throw new IllegalStateException("User " + username + " not found in the realm");
|
||||
}
|
||||
realm.addSocialLink(user, socialLink);
|
||||
realm.addSocialLink(user, new SocialLinkModel(requestData.getProviderId(), username));
|
||||
|
||||
// Expire cookie and invalidate requestData
|
||||
String cookiePath = Urls.socialBase(uriInfo.getBaseUri()).build().getPath();
|
||||
|
|
|
@ -28,11 +28,11 @@ import java.util.Map;
|
|||
*/
|
||||
public class AuthCallback {
|
||||
|
||||
private Map<String, Object> attributes;
|
||||
private Map<String, String> attributes;
|
||||
|
||||
private Map<String, String[]> queryParams;
|
||||
|
||||
public AuthCallback(Map<String, Object> attributes, Map<String, String[]> queryParams) {
|
||||
public AuthCallback(Map<String, String> attributes, Map<String, String[]> queryParams) {
|
||||
this.attributes = attributes;
|
||||
this.queryParams = queryParams;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ public class AuthRequest {
|
|||
|
||||
private URI authUri;
|
||||
|
||||
private Map<String, Object> attributes;
|
||||
private Map<String, String> attributes;
|
||||
|
||||
AuthRequest(String id, URI authUri, Map<String, Object> attributes) {
|
||||
AuthRequest(String id, URI authUri, Map<String, String> attributes) {
|
||||
this.id = id;
|
||||
this.authUri = authUri;
|
||||
this.attributes = attributes;
|
||||
|
@ -49,7 +49,7 @@ public class AuthRequest {
|
|||
return authUri;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAttributes() {
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class AuthRequestBuilder {
|
|||
|
||||
private UriBuilder b;
|
||||
|
||||
private Map<String, Object> attributes;
|
||||
private Map<String, String> attributes;
|
||||
|
||||
private String id;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class AuthRequestBuilder {
|
|||
AuthRequestBuilder req = new AuthRequestBuilder();
|
||||
req.id = id;
|
||||
req.b = UriBuilder.fromUri(path);
|
||||
req.attributes = new HashMap<String, Object>();
|
||||
req.attributes = new HashMap<String, String>();
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class AuthRequestBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public AuthRequestBuilder setAttribute(String name, Object value) {
|
||||
public AuthRequestBuilder setAttribute(String name, String value) {
|
||||
attributes.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ public class RequestDetails {
|
|||
|
||||
private Map<String, String> clientAttributes;
|
||||
|
||||
private Map<String, Object> socialAttributes;
|
||||
private Map<String, String> socialAttributes;
|
||||
|
||||
RequestDetails(String providerId, Map<String, String> clientAttributes, Map<String, Object> socialAttributes) {
|
||||
RequestDetails(String providerId, Map<String, String> clientAttributes, Map<String, String> socialAttributes) {
|
||||
this.providerId = providerId;
|
||||
this.clientAttributes = clientAttributes;
|
||||
this.socialAttributes = socialAttributes;
|
||||
|
@ -52,11 +52,11 @@ public class RequestDetails {
|
|||
return clientAttributes;
|
||||
}
|
||||
|
||||
public Object getSocialAttribute(String name) {
|
||||
public String getSocialAttribute(String name) {
|
||||
return socialAttributes.get(name);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSocialAttributes() {
|
||||
public Map<String, String> getSocialAttributes() {
|
||||
return socialAttributes;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class RequestDetailsBuilder {
|
|||
|
||||
private Map<String, String> clientAttributes;
|
||||
|
||||
private Map<String, Object> socialAttributes;
|
||||
private Map<String, String> socialAttributes;
|
||||
|
||||
private RequestDetailsBuilder() {
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class RequestDetailsBuilder {
|
|||
RequestDetailsBuilder req = new RequestDetailsBuilder();
|
||||
req.providerId = providerId;
|
||||
req.clientAttributes = new HashMap<String, String>();
|
||||
req.socialAttributes = new HashMap<String, Object>();
|
||||
req.socialAttributes = new HashMap<String, String>();
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class RequestDetailsBuilder {
|
|||
req.providerId = from.getProviderId();
|
||||
req.clientAttributes = new HashMap<String, String>();
|
||||
req.clientAttributes.putAll(from.getClientAttributes());
|
||||
req.socialAttributes = new HashMap<String, Object>();
|
||||
req.socialAttributes = new HashMap<String, String>();
|
||||
req.socialAttributes.putAll(from.getSocialAttributes());
|
||||
return req;
|
||||
}
|
||||
|
@ -66,12 +66,12 @@ public class RequestDetailsBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public RequestDetailsBuilder putSocialAttribute(String name, Object value) {
|
||||
public RequestDetailsBuilder putSocialAttribute(String name, String value) {
|
||||
socialAttributes.put(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestDetailsBuilder putSocialAttributes(Map<String, Object> attributes) {
|
||||
public RequestDetailsBuilder putSocialAttributes(Map<String, String> attributes) {
|
||||
socialAttributes.putAll(attributes);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,4 @@ public class SocialProviderConfig {
|
|||
return secret;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue