本文整理了Java中com.sun.enterprise.deployment.Application.getRoleMapper()
方法的一些代码示例,展示了Application.getRoleMapper()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getRoleMapper()
方法的具体详情如下:
包路径:com.sun.enterprise.deployment.Application
类名称:Application
方法名:getRoleMapper
[英]Return my mapping of rolename to users and groups on a particular server.
[中]将我的rolename映射返回到特定服务器上的用户和组。
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Reset the display name of this application.
*
* @param name the display name of the application.
*/
public void setName(String name) {
name = name.replace('/', '-');
name = name.replace('\\', '-'); // for deploying from NT to solaris & vice versa. This will
// need to be cleaned when we clean up the backend for registering apps
super.setName(name);
if (this.getRoleMapper() != null) {
this.getRoleMapper().setName(name);
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Reset the display name of this application.
*
* @param name the display name of the application.
*/
public void setName(String name) {
name = name.replace('/', '-');
name = name.replace('\\', '-'); // for deploying from NT to solaris & vice versa. This will
// need to be cleaned when we clean up the backend for registering apps
super.setName(name);
if (this.getRoleMapper() != null) {
this.getRoleMapper().setName(name);
}
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* A formatted String representing my state.
*/
public void print(StringBuffer toStringBuffer) {
toStringBuffer.append("Application");
toStringBuffer.append("\n");
super.print(toStringBuffer);
toStringBuffer.append("\n smallIcon ").append(super.getSmallIconUri());
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
toStringBuffer.append("\n Module : ");
aModule.print(toStringBuffer);
}
toStringBuffer.append("\n Bundles: \n");
printDescriptorSet(this.getBundleDescriptors(), toStringBuffer);
toStringBuffer.append("\n roles ").append(getRoles());
toStringBuffer.append("\n RoleMapper ").append(this.getRoleMapper());
toStringBuffer.append("\n Realm ").append(realm);
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* A formatted String representing my state.
*/
public void print(StringBuffer toStringBuffer) {
toStringBuffer.append("Application");
toStringBuffer.append("\n");
super.print(toStringBuffer);
toStringBuffer.append("\n smallIcon ").append(super.getSmallIconUri());
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
toStringBuffer.append("\n Module : ");
aModule.print(toStringBuffer);
}
toStringBuffer.append("\n EjbBundles: \n");
if (this.getEjbBundleDescriptors() != null)
printDescriptorSet(this.getEjbBundleDescriptors(), toStringBuffer);
toStringBuffer.append("\n WebBundleDescriptors ");
if (this.getWebBundleDescriptors() != null)
printDescriptorSet(this.getWebBundleDescriptors(), toStringBuffer);
toStringBuffer.append("\n applicationClientDescriptors ");
if (this.getApplicationClientDescriptors() != null)
printDescriptorSet(this.getApplicationClientDescriptors(), toStringBuffer);
toStringBuffer.append("\n roles ").append(getRoles());
toStringBuffer.append("\n RoleMapper ").append(this.getRoleMapper());
toStringBuffer.append("\n Realm ").append(realm);
}
代码示例来源:origin: org.glassfish.deployment/dol
(runAs.getPrincipal() == null ||
runAs.getPrincipal().length() == 0) &&
application != null && application.getRoleMapper() != null) {
final Subject fs = (Subject)application.getRoleMapper().getRoleToSubjectMapping().get(roleName);
if (fs != null) {
principalName = (String)AccessController.doPrivileged(new PrivilegedAction() {
代码示例来源:origin: org.glassfish.main.deployment/dol
(runAs.getPrincipal() == null ||
runAs.getPrincipal().length() == 0) &&
application != null && application.getRoleMapper() != null) {
final Subject fs = (Subject)application.getRoleMapper().getRoleToSubjectMapping().get(roleName);
if (fs != null) {
principalName = (String)AccessController.doPrivileged(new PrivilegedAction() {
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Sets the registration name for this application. This name is used
* while deploying the application. The deployment process gurantees
* that this name is unique.
*
* @param appId the registration name used for this application
*/
public void setRegistrationName(String appId) {
// at his point we need to swap our RoleMapper, if we have one...
SecurityRoleMapper roleMapper = null;
try {
roleMapper = getRoleMapper();
} catch (IllegalArgumentException ignore) {
}
if (roleMapper != null) {
if (securityRoleMapperFactory == null) {
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.norolemapperfactorydefine",
"This application has no role mapper factory defined"));
}
securityRoleMapperFactory.removeRoleMapper(getName());
roleMapper.setName(appId);
securityRoleMapperFactory.setRoleMapper(appId, roleMapper);
}
this.registrationName = appId;
}
代码示例来源:origin: org.glassfish.main.ejb/ejb-container
@Override
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof SecurityRoleMapping) {
SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor;
descriptor.addSecurityRoleMapping(roleMap);
Application app = descriptor.getApplication();
if (app!=null) {
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = app.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(principals.get(i).getPrincipal(),
role, descriptor);
}
List<String> groups = roleMap.getGroupNames();
for (int i = 0; i < groups.size(); i++) {
rm.assignRole(new Group(groups.get(i)),
role, descriptor);
}
}
}
}
}
代码示例来源:origin: org.glassfish.main.security/security-ee
return;
SecurityRoleMapper rmap = app.getRoleMapper();
if (rmap == null) {
logger.finest("- No role mappings present.");
代码示例来源:origin: org.glassfish.security/security
return;
SecurityRoleMapper rmap = app.getRoleMapper();
if (rmap == null) {
logger.finest("- No role mappings present.");
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Adds a new DOL descriptor instance to the descriptor instance associated with
* this XMLNode
*
* @param newDescriptor the new descriptor
*/
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof SecurityRoleMapping) {
SecurityRoleMapping roleMap = (SecurityRoleMapping) newDescriptor;
if (descriptor!=null && !descriptor.isVirtual()) {
descriptor.addSecurityRoleMapping(roleMap);
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = descriptor.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(principals.get(i).getPrincipal(),
role, descriptor);
}
List<String> groups = roleMap.getGroupNames();
for (int i = 0; i < groups.size(); i++) {
rm.assignRole(new Group(groups.get(i)),
role, descriptor);
}
}
}
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Adds a new DOL descriptor instance to the descriptor instance associated with
* this XMLNode
*
* @param mewDescriptor the new descriptor
*/
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof SecurityRoleMapping) {
SecurityRoleMapping roleMap = (SecurityRoleMapping) newDescriptor;
descriptor.addSecurityRoleMapping(roleMap);
if (descriptor!=null && !descriptor.isVirtual()) {
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = descriptor.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(principals.get(i).getPrincipal(),
role, descriptor);
}
List<String> groups = roleMap.getGroupNames();
for (int i = 0; i < groups.size(); i++) {
rm.assignRole(new Group(groups.get(i)),
role, descriptor);
}
}
}
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Adds a new DOL descriptor instance to the descriptor instance associated with
* this XMLNode
*
* @param descriptor the new descriptor
*/
public void addDescriptor(Object newDescriptor) {
if (newDescriptor instanceof SecurityRoleMapping) {
SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor;
descriptor.addSecurityRoleMapping(roleMap);
Application app = descriptor.getApplication();
if (app!=null) {
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = app.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(principals.get(i).getPrincipal(),
role, descriptor);
}
List<String> groups = roleMap.getGroupNames();
for (int i = 0; i < groups.size(); i++) {
rm.assignRole(new Group(groups.get(i)),
role, descriptor);
}
}
}
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Sets the registration name for this application. This name is used
* while deploying the application. The deployment process gurantees
* that this name is unique.
*
* @param appId the registration name used for this application
*/
public void setRegistrationName(String appId) {
// at his point we need to swap our RoleMapper, if we have one...
SecurityRoleMapper roleMapper = null;
try {
roleMapper = getRoleMapper();
} catch (IllegalArgumentException ignore) {
}
if (roleMapper != null) {
SecurityRoleMapperFactory factory = habitat.getComponent(SecurityRoleMapperFactory.class);
if (factory == null) {
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.norolemapperfactorydefine",
"This application has no role mapper factory defined"));
}
factory.removeRoleMapper(getName());
roleMapper.setName(appId);
factory.setRoleMapper(appId, roleMapper);
}
this.registrationName = appId;
}
代码示例来源:origin: org.glassfish.deployment/dol
descriptor.addWLRoleAssignments(roleMap);
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = descriptor.getRoleMapper();
if (rm != null) {
if(roleMap.isExternallyDefined()){
代码示例来源:origin: org.glassfish.deployment/dol
SecurityRoleMapper rm = null;
if (app != null) {
rm = app.getRoleMapper();
} else {
rm = getRoleMapper();
代码示例来源:origin: org.glassfish.deployment/dol
if (app!=null) {
Role role = new Role(srm.getRoleName());
SecurityRoleMapper rm = app.getRoleMapper();
if (rm != null) {
List<PrincipalNameDescriptor> principals = srm.getPrincipalNames();
内容来源于网络,如有侵权,请联系作者删除!