1 23 package com.sun.enterprise.web.deploy; 24 25 import org.apache.catalina.deploy.SecurityCollection; 26 import com.sun.enterprise.deployment.web.SecurityConstraint; 27 import com.sun.enterprise.deployment.web.SecurityRole; 28 import com.sun.enterprise.web.WebModule; 29 30 import java.util.ArrayList ; 31 import java.util.Collections ; 32 import java.util.Enumeration ; 33 38 public class SecurityConstraintDecorator 39 extends org.apache.catalina.deploy.SecurityConstraint { 40 41 private SecurityConstraint securityConstraint; 42 43 public SecurityConstraintDecorator(SecurityConstraint securityConstraint, 44 WebModule webModule){ 45 this.securityConstraint = securityConstraint; 46 47 if (securityConstraint.getAuthorizationConstraint() != null){ 48 setAuthConstraint(true); 49 Enumeration enumeration = securityConstraint 50 .getAuthorizationConstraint().getSecurityRoles(); 51 52 SecurityRole securityRole; 53 while (enumeration.hasMoreElements()){ 54 securityRole = (SecurityRole)enumeration.nextElement(); 55 super.addAuthRole(securityRole.getName()); 56 if ( !securityRole.getName().equals("*")){ 57 webModule.addSecurityRole(securityRole.getName()); 58 } 59 } 60 setDisplayName(securityConstraint.getAuthorizationConstraint().getName()); 61 } 62 63 if (securityConstraint.getUserDataConstraint() != null){ 64 setUserConstraint(securityConstraint.getUserDataConstraint() 65 .getTransportGuarantee()); 66 } 67 68 } 69 70 } 71 72 73 74 | Popular Tags |