Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6951 from pedroigor/master
[WFLY-3978] - PicketLink EAP 6.4 Issues
- Loading branch information
Showing
22 changed files
with
544 additions
and
234 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...a/org/wildfly/extension/picketlink/federation/model/AbstractEntityProviderAddHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2012, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.wildfly.extension.picketlink.federation.model; | ||
|
||
import org.jboss.as.controller.AbstractAddStepHandler; | ||
import org.jboss.as.controller.OperationContext; | ||
import org.jboss.as.controller.OperationFailedException; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.dmr.Property; | ||
import org.picketlink.config.federation.KeyValueType; | ||
import org.picketlink.config.federation.handler.Handler; | ||
import org.wildfly.extension.picketlink.common.model.ModelElement; | ||
import org.wildfly.extension.picketlink.federation.service.EntityProviderService; | ||
|
||
import static org.wildfly.extension.picketlink.common.model.ModelElement.COMMON_HANDLER_PARAMETER; | ||
import static org.wildfly.extension.picketlink.federation.model.handlers.HandlerAddHandler.toHandlerConfig; | ||
import static org.wildfly.extension.picketlink.federation.model.handlers.HandlerParameterAddHandler.toHandlerParameterConfig; | ||
|
||
/** | ||
* @author Pedro Igor | ||
*/ | ||
public abstract class AbstractEntityProviderAddHandler extends AbstractAddStepHandler { | ||
|
||
protected static void configureHandler(OperationContext context, ModelNode model, EntityProviderService service) throws OperationFailedException { | ||
if (model.hasDefined(ModelElement.COMMON_HANDLER.getName())) { | ||
for (Property handlerProperty : model.get(ModelElement.COMMON_HANDLER.getName()).asPropertyList()) { | ||
ModelNode handler = handlerProperty.getValue(); | ||
Handler newHandler = toHandlerConfig(context, handler); | ||
|
||
if (handler.hasDefined(COMMON_HANDLER_PARAMETER.getName())) { | ||
for (Property handlerParameter : handler.get(COMMON_HANDLER_PARAMETER.getName()).asPropertyList()) { | ||
String paramName = handlerParameter.getName(); | ||
ModelNode parameterNode = handlerParameter.getValue(); | ||
KeyValueType kv = toHandlerParameterConfig(context, paramName, parameterNode); | ||
|
||
newHandler.add(kv); | ||
} | ||
} | ||
|
||
service.addHandler(newHandler); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 16 additions & 20 deletions
36
...wildfly/extension/picketlink/federation/model/handlers/HandlerParameterRemoveHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
package org.wildfly.extension.picketlink.federation.model.handlers; | ||
|
||
import org.jboss.as.controller.AbstractRemoveStepHandler; | ||
import org.jboss.as.controller.OperationContext; | ||
import org.jboss.as.controller.OperationFailedException; | ||
import org.jboss.as.controller.PathAddress; | ||
import org.jboss.as.controller.RestartParentResourceRemoveHandler; | ||
import org.jboss.as.controller.ServiceVerificationHandler; | ||
import org.jboss.dmr.ModelNode; | ||
import org.jboss.msc.service.ServiceName; | ||
import org.wildfly.extension.picketlink.federation.service.SAMLHandlerService; | ||
import org.wildfly.extension.picketlink.common.model.ModelElement; | ||
import org.wildfly.extension.picketlink.federation.service.EntityProviderService; | ||
|
||
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADDRESS; | ||
|
||
/** | ||
* @author Pedro Igor | ||
*/ | ||
public class HandlerParameterRemoveHandler extends RestartParentResourceRemoveHandler { | ||
public class HandlerParameterRemoveHandler extends AbstractRemoveStepHandler { | ||
|
||
static final HandlerParameterRemoveHandler INSTANCE = new HandlerParameterRemoveHandler(); | ||
|
||
private HandlerParameterRemoveHandler() { | ||
super(ModelElement.COMMON_HANDLER.getName()); | ||
} | ||
|
||
@Override | ||
protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel, | ||
ServiceVerificationHandler verificationHandler) throws OperationFailedException { | ||
HandlerAddHandler.INSTANCE.launchServices(context, parentAddress, parentModel, verificationHandler, null); | ||
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { | ||
PathAddress pathAddress = PathAddress.pathAddress(operation.get(ADDRESS)); | ||
String providerAlias = pathAddress.subAddress(0, pathAddress.size() - 2).getLastElement().getValue(); | ||
String handlerType = pathAddress.subAddress(0, pathAddress.size() - 1).getLastElement().getValue(); | ||
EntityProviderService providerService = EntityProviderService.getService(context, providerAlias); | ||
|
||
String handlerParameterName = pathAddress.getLastElement().getValue(); | ||
providerService.removeHandlerParameter(handlerType, handlerParameterName); | ||
} | ||
|
||
@Override | ||
protected ServiceName getParentServiceName(PathAddress parentAddress) { | ||
String providerAlias = parentAddress.subAddress(0, parentAddress.size() - 1).getLastElement().getValue(); | ||
String handlerName = parentAddress.getLastElement().getValue(); | ||
|
||
return SAMLHandlerService.createServiceName(providerAlias, handlerName); | ||
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) | ||
throws OperationFailedException { | ||
HandlerParameterAddHandler.INSTANCE.performRuntime(context, operation, model, null, null); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.