MappingContext<RoleGroup> mappingContext = domainContext.getMappingManager().getMappingContext(MappingType.ROLE.name()); if (mappingContext != null && mappingContext.hasModules()) { RoleGroup roleGroup = new SimpleRoleGroup(groupPrincipals); Map<String, Object> contextMap = new HashMap<>(); contextMap.put(SecurityConstants.PRINCIPAL_IDENTIFIER, this.principal); mappingContext.performMapping(contextMap, roleGroup);
} else { MappingContext<RoleGroup> mc = mappingManager.getMappingContext(MappingType.ROLE.name()); if (mc != null && mc.hasModules()) { SecurityRolesAssociation.setSecurityRoles(principleVsRoleMap);
private boolean processMapping(OperationContext context, String securityDomain, ModelNode node, ApplicationPolicy applicationPolicy) throws OperationFailedException { node = peek(node, MAPPING, CLASSIC, MAPPING_MODULE); if (node == null) { return false; } for (Property moduleProperty : node.asPropertyList()) { ModelNode module = moduleProperty.getValue(); MappingInfo mappingInfo = new MappingInfo(securityDomain); String codeName = extractCode(context, module, ModulesMap.MAPPING_MAP); String mappingType; if (module.hasDefined(TYPE)) { mappingType = MappingModuleDefinition.TYPE.resolveModelAttribute(context, module).asString(); } else { mappingType = MappingType.ROLE.toString(); } Map<String, Object> options = extractOptions(context, module); MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType); mappingInfo.add(entry); applicationPolicy.setMappingInfo(mappingType, mappingInfo); ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module); if (moduleName.isDefined() && !moduleName.asString().isEmpty()) { mappingInfo.addJBossModuleName(moduleName.asString()); } else { mappingInfo.addJBossModuleName(DEFAULT_MODULE); } } return true; }
String mappingType = MappingType.ATTRIBUTE.name(); MappingManager mm = sc.getMappingManager(); MappingContext<List<Attribute<Object>>> mc = mm.getMappingContext(mappingType); mc.performMapping(contextMap, attList); } catch (Exception e) { logger.attributeManagerError(e); attList = (List<Attribute<Object>>) mc.getMappingResult().getMappedObject();
/** * Apply mapping semantics on the passed object * @param contextMap Read-only Contextual Map * @param mappedObject an object on which mapping will be applied */ public void performMapping(Map<String,Object> contextMap, T mappedObject) { int len = modules.size(); result = new MappingResult<T>(); for(int i = 0 ; i < len; i++) { MappingProvider<T> mp = (MappingProvider<T>)modules.get(i); mp.setMappingResult(result); mp.performMapping(contextMap, mappedObject); } }
/** * Create a new MappingModuleEntry. * * @param name Policy Module Name * @param options Options */ public MappingModuleEntry(String name, Map<String, Object> options) { this(name, options, MappingType.ROLE.toString()); }
public void performMapping(Map<String, Object> map, Principal mappedObject) { if(mappedObject instanceof SimplePrincipal == false) return; SimplePrincipal simplePrincipal = (SimplePrincipal) mappedObject; if(principalMapProperties != null) { String newPrincipalName = principalMapProperties.getProperty(simplePrincipal.getName()); if(newPrincipalName != null && newPrincipalName.length() > 0) { result.setMappedObject(new SimplePrincipal(newPrincipalName)); } } }
public void performMapping(Map<String, Object> contextMap, RoleGroup mappedObject) { if (contextMap == null || contextMap.isEmpty()) throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextMap"); //Obtain the principal to roles mapping Principal principal = getCallerPrincipal(contextMap); if (principal != null) { String username = principal.getName(); Util.addRolesToGroup(username, mappedObject, roles); result.setMappedObject(mappedObject); } }
public void performMapping(Map<String, Object> contextMap, RoleGroup mappedObject) { if (contextMap == null || contextMap.isEmpty()) throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextMap"); //Obtain the principal to roles mapping Principal principal = getCallerPrincipal(contextMap); if (principal != null && rolesQuery != null) { String username = principal.getName(); Util.addRolesToGroup(username, mappedObject, dsJndiName, rolesQuery, suspendResume, tm); result.setMappedObject(mappedObject); } }
@SuppressWarnings("unchecked") private <T> MappingProvider<T> getMappingProvider(ClassLoader cl, MappingModuleEntry mme) { MappingProvider<T> mp = null; try { String fqn = mme.getMappingModuleName(); Class<?> clazz = SecurityActions.loadClass(cl, fqn); mp = (MappingProvider<T>) clazz.newInstance(); mp.init(mme.getOptions()); } catch(Exception e) { PicketBoxLogger.LOGGER.debugIgnoredException(e); } return mp; } }
/** * Apply mapping semantics on the passed object * @param obj Read-only Contextual Map * @param mappedObject an object on which mapping will be applied */ public <T> void performMapping(Map obj, T mappedObject) { int len = modules.size(); for(int i = 0 ; i < len; i++) { MappingProvider<T> mp = (MappingProvider<T>)modules.get(i); mp.performMapping(obj, mappedObject); } } }
String mappingType = MappingType.ATTRIBUTE.name(); MappingManager mm = sc.getMappingManager(); MappingContext<List<Attribute<Object>>> mc = mm.getMappingContext(mappingType); mc.performMapping(contextMap, attList); } catch (Exception e) { logger.attributeManagerError(e); attList = (List<Attribute<Object>>) mc.getMappingResult().getMappedObject();
} else { MappingContext<RoleGroup> mc = mappingManager.getMappingContext(MappingType.ROLE.name()); if (mc != null && mc.hasModules()) { SecurityRolesAssociation.setSecurityRoles(principleVsRoleMap);
/** * Apply mapping semantics on the passed object * @param contextMap Read-only Contextual Map * @param mappedObject an object on which mapping will be applied */ public void performMapping(Map<String,Object> contextMap, T mappedObject) { int len = modules.size(); result = new MappingResult<T>(); for(int i = 0 ; i < len; i++) { MappingProvider<T> mp = (MappingProvider<T>)modules.get(i); mp.setMappingResult(result); mp.performMapping(contextMap, mappedObject); } }
/** * Create a new MappingModuleEntry. * * @param name Policy Module Name * @param options Options */ public MappingModuleEntry(String name, Map<String, Object> options) { this(name, options, MappingType.ROLE.toString()); }
public void performMapping(Map<String,Object> contextMap, Principal principal) { if(contextMap == null) throw new IllegalArgumentException("ContextMap is null"); X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509"); if(certs != null) { SubjectDNMapping sdn = new SubjectDNMapping(); principal = sdn.toPrinicipal(certs); if(log.isTraceEnabled()) log.trace("Mapped to Principal:"+principal); } result.setMappedObject(principal); } }
/** * Apply mapping semantics on the passed object * @param contextMap Read-only Contextual Map * @param mappedObject an object on which mapping will be applied */ public void performMapping(Map<String,Object> contextMap, T mappedObject) { int len = modules.size(); result = new MappingResult<T>(); for(int i = 0 ; i < len; i++) { MappingProvider<T> mp = (MappingProvider<T>)modules.get(i); mp.setMappingResult(result); mp.performMapping(contextMap, mappedObject); } }
public void performMapping(Map<String,Object> contextMap, Principal principal) { if(principal instanceof X500Principal == false) return; if(contextMap == null) throw new IllegalArgumentException("ContextMap is null"); X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509"); if(certs != null) { SubjectCNMapping sdn = new SubjectCNMapping(); principal = sdn.toPrinicipal(certs); if(log.isTraceEnabled()) log.trace("Mapped to Principal:"+principal); } result.setMappedObject(principal); } }
public void performMapping(Map<String,Object> contextMap, Principal principal) { if(contextMap == null) throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextMap"); X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509"); if(certs != null) { SubjectDNMapping sdn = new SubjectDNMapping(); principal = sdn.toPrinicipal(certs); PicketBoxLogger.LOGGER.traceMappedX500Principal(principal); } result.setMappedObject(principal); } }
public void performMapping(Map<String,Object> contextMap, Principal principal) { if(principal instanceof X500Principal == false) return; if(contextMap == null) throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextMap"); X509Certificate[] certs = (X509Certificate[]) contextMap.get("X509"); if(certs != null) { SubjectCNMapping sdn = new SubjectCNMapping(); principal = sdn.toPrinicipal(certs); PicketBoxLogger.LOGGER.traceMappedX500Principal(principal); } result.setMappedObject(principal); } }