-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WFLY-3978] - PicketLink EAP 6.4 Issues #6951
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle rollback: add handler