public void removeHandlerParameter(String handlerType, String handlerParameterName) { for (Handler handler : this.handlers) { if (handler.getClazz().equals(handlerType)) { for (KeyValueType kv : new ArrayList<KeyValueType>(handler.getOption())) { if (kv.getKey().equals(handlerParameterName)) { handler.remove(kv); } } } } }
public void removeHandlerParameter(String handlerType, String handlerParameterName) { for (Handler handler : this.handlers) { if (handler.getClazz().equals(handlerType)) { for (KeyValueType kv : new ArrayList<KeyValueType>(handler.getOption())) { if (kv.getKey().equals(handlerParameterName)) { handler.remove(kv); } } } } }
public String getNameIdFormat() { try { Handler authHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"); List<KeyValueType> options = authHandler.getOption(); for(KeyValueType option:options) { if (option.getKey().equals(GeneralConstants.NAMEID_FORMAT)){ return option.getValue(); } } return null; } catch (ParsingException e) { throw new RuntimeException(e); } }
public String getNameIdFormat() { try { Handler authHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"); List<KeyValueType> options = authHandler.getOption(); for(KeyValueType option:options) { if (option.getKey().equals(GeneralConstants.NAMEID_FORMAT)){ return option.getValue(); } } return null; } catch (ParsingException e) { throw new RuntimeException(e); } }
@SuppressWarnings("rawtypes") @Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String providerAlias = operation.get(ModelDescriptionConstants.ADDRESS).asPropertyList().get(2).getValue().asString(); String handlerClassName = operation.get(ModelDescriptionConstants.ADDRESS).asPropertyList().get(3).getValue().asString(); String paramName = operation.get(ModelElement.COMMON_NAME.getName()).asString(); AbstractEntityProviderService providerService = getParentProviderService(context, providerAlias); Handlers handlerChain = providerService.getPicketLinkType().getHandlers(); for (Handler handler : new ArrayList<Handler>(handlerChain.getHandler())) { if (handler.getClazz().equals(handlerClassName)) { for (KeyValueType keyValueType : new ArrayList<KeyValueType>(handler.getOption())) { if (keyValueType.getKey().equals(paramName)) { handler.remove(keyValueType); } } } } }
public static Set<SAML2Handler> getHandlers(Handlers handlers) throws ConfigurationException { if (handlers == null) throw logger.nullArgumentError("handlers"); List<Handler> handlerList = handlers.getHandler(); Set<SAML2Handler> handlerSet = new LinkedHashSet<SAML2Handler>(); for (Handler handler : handlerList) { SAML2Handler samlhandler = createInstance(handler); List<KeyValueType> options = handler.getOption(); Map<String, Object> mapOptions = new HashMap<String, Object>(); for (KeyValueType kvtype : options) { mapOptions.put(kvtype.getKey(), kvtype.getValue()); } SAML2HandlerConfig handlerConfig = new DefaultSAML2HandlerConfig(); handlerConfig.set(mapOptions); samlhandler.initHandlerConfig(handlerConfig); handlerSet.add(samlhandler); } return handlerSet; }
public static Set<SAML2Handler> getHandlers(Handlers handlers) throws ConfigurationException { if (handlers == null) throw logger.nullArgumentError("handlers"); List<Handler> handlerList = handlers.getHandler(); Set<SAML2Handler> handlerSet = new LinkedHashSet<SAML2Handler>(); for (Handler handler : handlerList) { SAML2Handler samlhandler = createInstance(handler); List<KeyValueType> options = handler.getOption(); Map<String, Object> mapOptions = new HashMap<String, Object>(); for (KeyValueType kvtype : options) { mapOptions.put(kvtype.getKey(), kvtype.getValue()); } SAML2HandlerConfig handlerConfig = new DefaultSAML2HandlerConfig(); handlerConfig.set(mapOptions); samlhandler.initHandlerConfig(handlerConfig); handlerSet.add(samlhandler); } return handlerSet; }
private AttributeConsumingServiceType getAttributeConsumerService() { try { Handler attributeHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AttributeHandler"); List<KeyValueType> options = attributeHandler.getOption(); ArrayList<String> attributeVals = new ArrayList<String>(); for(KeyValueType option:options) if (option.getKey().equals(ATTRIBUTE_KEYS)){ for(String str:option.getValue().split(",")) attributeVals.add(str); } AttributeConsumingServiceType attributeConsumingService = new AttributeConsumingServiceType(0); for(String attributeVal:attributeVals){ RequestedAttributeType requestedAttributeType = new RequestedAttributeType(attributeVal); requestedAttributeType.setIsRequired(true); requestedAttributeType.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_BASIC.get()); attributeConsumingService.addRequestedAttribute(requestedAttributeType); } LocalizedNameType serviceLocName = new LocalizedNameType(JBossSAMLConstants.LANG_EN.get()); serviceLocName.setValue(serviceName); attributeConsumingService.addServiceName(serviceLocName); attributeConsumingService.setIsDefault(true); return attributeConsumingService; } catch (ParsingException e) { throw new RuntimeException(e); } }
private AttributeConsumingServiceType getAttributeConsumerService() { try { Handler attributeHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AttributeHandler"); List<KeyValueType> options = attributeHandler.getOption(); ArrayList<String> attributeVals = new ArrayList<String>(); for(KeyValueType option:options) if (option.getKey().equals(ATTRIBUTE_KEYS)){ for(String str:option.getValue().split(",")) attributeVals.add(str); } AttributeConsumingServiceType attributeConsumingService = new AttributeConsumingServiceType(0); for(String attributeVal:attributeVals){ RequestedAttributeType requestedAttributeType = new RequestedAttributeType(attributeVal); requestedAttributeType.setIsRequired(true); requestedAttributeType.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_BASIC.get()); attributeConsumingService.addRequestedAttribute(requestedAttributeType); } LocalizedNameType serviceLocName = new LocalizedNameType(JBossSAMLConstants.LANG_EN.get()); serviceLocName.setValue(serviceName); attributeConsumingService.addServiceName(serviceLocName); attributeConsumingService.setIsDefault(true); return attributeConsumingService; } catch (ParsingException e) { throw new RuntimeException(e); } }