/** * Returns security domain value. This method checks domain is the same for every EJB 3 endpoint. * * @param oldSecurityDomain our security domain * @param nextSecurityDomain next security domain * @return security domain value * @throws IllegalStateException if domains have different values */ private String getDomain(final String oldSecurityDomain, final SecurityDomain nextSecurityDomain) { if (nextSecurityDomain == null) { return oldSecurityDomain; } if (oldSecurityDomain == null) { return nextSecurityDomain.value(); } this.ensureSameDomains(oldSecurityDomain, nextSecurityDomain.value()); return oldSecurityDomain; }
/** * @author sletellier */ @Stateless @SecurityDomain("sandra") @PermitAll public class ServiceSynchNumberImpl extends BaseServiceImpl implements ServiceSynchNumberLocal, ServiceSynchNumber { @Override @Transaction public Long getNextSynchroNumber() throws TopiaException { throw new RuntimeException("This method must be never call"); } public Long getNextSynchroNumber(TopiaContext transaction) throws TopiaException { return SynchNumberManager.getNextSynchroNumber(transaction); } @Override @Transaction public Long getCurrentSynchroNumber() throws TopiaException { throw new RuntimeException("This method must be never call"); } public Long getCurrentSynchroNumber(TopiaContext transaction) throws TopiaException { return SynchNumberManager.getCurrentSynchroNumber(transaction); } }
boolean domainExists = domain != null && domain.value() != null && domain.value().length() > 0; String domainValue = canonicalizeSecurityDomain(domain.value()); String unauthenticatedPrincipal = domain.unauthenticatedPrincipal(); if(userPrincipal == null && unauthenticatedPrincipal !=null && unauthenticatedPrincipal.length() > 0)
/** * Returns security domain value. This method checks domain is the same for every EJB 3 endpoint. * * @param oldSecurityDomain our security domain * @param nextSecurityDomain next security domain * @return security domain value * @throws IllegalStateException if domains have different values */ private String getDomain(final String oldSecurityDomain, final SecurityDomain nextSecurityDomain) { if (nextSecurityDomain == null) { return oldSecurityDomain; } if (oldSecurityDomain == null) { return nextSecurityDomain.value(); } this.ensureSameDomains(oldSecurityDomain, nextSecurityDomain.value()); return oldSecurityDomain; }
/** * @author sletellier */ @Stateless @SecurityDomain("sandra") @PermitAll public class ServiceSynchNumberImpl extends BaseServiceImpl implements ServiceSynchNumberLocal, ServiceSynchNumber { @Override @Transaction public Long getNextSynchroNumber() throws TopiaException { throw new RuntimeException("This method must be never call"); } public Long getNextSynchroNumber(TopiaContext transaction) throws TopiaException { return SynchNumberManager.getNextSynchroNumber(transaction); } @Override @Transaction public Long getCurrentSynchroNumber() throws TopiaException { throw new RuntimeException("This method must be never call"); } public Long getCurrentSynchroNumber(TopiaContext transaction) throws TopiaException { return SynchNumberManager.getCurrentSynchroNumber(transaction); } }
/** * Returns security domain value. This method checks domain is the same for every EJB 3 endpoint. * * @param oldSecurityDomain our security domain * @param nextSecurityDomain next security domain * @return security domain value * @throws IllegalStateException if domains have different values */ private String getDomain(final String oldSecurityDomain, final SecurityDomain nextSecurityDomain) { if (nextSecurityDomain == null) { return oldSecurityDomain; } if (oldSecurityDomain == null) { return nextSecurityDomain.value(); } this.ensureSameDomains(oldSecurityDomain, nextSecurityDomain.value()); return oldSecurityDomain; }
@SecurityDomain(value = "sandra") @PermitAll public class InjectorIBUImpl extends BaseServiceImpl implements InjectorIBU, InjectorIBULocal {
@SuppressWarnings("unchecked") public <T> T getSecurityManager(Class<T> type) { try { InitialContext ctx = getInitialContext(); SecurityDomain securityAnnotation = (SecurityDomain) resolveAnnotation(SecurityDomain.class); if (securityAnnotation != null && securityAnnotation.value().length() > 0) { return (T) SecurityDomainManager.getSecurityManager(securityAnnotation.value(),ctx); } return null; } catch (NamingException e) { throw new RuntimeException(e); } }
@SecurityDomain(value = "sandra") @PermitAll public class InjectorIBUImpl extends BaseServiceImpl implements InjectorIBU, InjectorIBULocal {
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep) { String securityDomain = null; WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class); if (webServiceDeployment != null) { Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator(); while (it.hasNext()) { WebServiceDeclaration container = it.next(); SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class); if (anSecurityDomain != null) { if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value())) throw new IllegalStateException("Multiple security domains not supported"); securityDomain = anSecurityDomain.value(); } } } if (securityDomain != null) { if (securityDomain.startsWith("java:/jaas/") == false) securityDomain = "java:/jaas/" + securityDomain; jbossWeb.setSecurityDomain(securityDomain); } }
@Stateless @SecurityDomain("sandra") @PermitAll public class ServiceScheduleImpl extends BaseServiceImpl implements ServiceSchedule, ServiceScheduleLocal {
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep) { String securityDomain = null; WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class); if (webServiceDeployment != null) { Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator(); while (it.hasNext()) { WebServiceDeclaration container = it.next(); SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class); if (anSecurityDomain != null) { if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value())) throw new IllegalStateException("Multiple security domains not supported"); securityDomain = anSecurityDomain.value(); } } } if (securityDomain != null) { if (securityDomain.startsWith("java:/jaas/") == false) securityDomain = "java:/jaas/" + securityDomain; jbossWeb.setSecurityDomain(securityDomain); } }
@Stateless @SecurityDomain("sandra") @PermitAll public class ServiceScheduleImpl extends BaseServiceImpl implements ServiceSchedule, ServiceScheduleLocal {
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep) { String securityDomain = null; WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class); if (webServiceDeployment != null) { Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator(); while (it.hasNext()) { WebServiceDeclaration container = it.next(); SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class); if (anSecurityDomain != null) { if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value())) throw new IllegalStateException("Multiple security domains not supported"); securityDomain = anSecurityDomain.value(); } } } if (securityDomain != null) { if (securityDomain.startsWith("java:/jaas/") == false) securityDomain = "java:/jaas/" + securityDomain; jbossWeb.setSecurityDomain(securityDomain); } }
@Stateless @SecurityDomain("sandra") @RunAsPrincipal("notifier") public class ServiceNotifierImpl extends BaseServiceImpl implements ServiceNotifierLocal {
public void addSecurityDomain(JBossWebMetaData jbossWeb, Deployment dep) { String securityDomain = null; WebServiceDeployment webServiceDeployment = dep.getAttachment(WebServiceDeployment.class); if (webServiceDeployment != null) { Iterator<WebServiceDeclaration> it = webServiceDeployment.getServiceEndpoints().iterator(); while (it.hasNext()) { WebServiceDeclaration container = it.next(); SecurityDomain anSecurityDomain = container.getAnnotation(SecurityDomain.class); if (anSecurityDomain != null) { if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value())) throw new IllegalStateException("Multiple security domains not supported"); securityDomain = anSecurityDomain.value(); } } } if (securityDomain != null) { if (securityDomain.startsWith("java:/jaas/") == false) securityDomain = "java:/jaas/" + securityDomain; jbossWeb.setSecurityDomain(securityDomain); } }
@Stateless @SecurityDomain("sandra") @RunAsPrincipal("notifier") public class ServiceNotifierImpl extends BaseServiceImpl implements ServiceNotifierLocal {
public void addSecurityDomain(Element jbossWeb, Deployment dep) { String securityDomain = null; Ejb3Deployment ejb3Deployment = dep.getAttachment(Ejb3Deployment.class); if (ejb3Deployment != null) { Iterator it = ejb3Deployment.getEjbContainers().values().iterator(); while (it.hasNext()) { EJBContainer container = (EJBContainer)it.next(); SecurityDomain anSecurityDomain = (SecurityDomain)container.resolveAnnotation(SecurityDomain.class); if (anSecurityDomain != null) { if (securityDomain != null && !securityDomain.equals(anSecurityDomain.value())) throw new IllegalStateException("Multiple security domains not supported"); securityDomain = anSecurityDomain.value(); } } } if (securityDomain != null) { if (securityDomain.startsWith("java:/jaas/") == false) securityDomain = "java:/jaas/" + securityDomain; jbossWeb.addElement("security-domain").addText(securityDomain); } }
@Stateless @SecurityDomain("sandra") @PermitAll public class ServiceTourImpl extends BaseServiceImpl implements ServiceTour, ServiceTourLocal {
public Object createPerClass(Advisor advisor) { EJBContainer container = EJBContainer.getEJBContainer(advisor); Object domain = null; try { InitialContext ctx = container.getInitialContext(); SecurityDomain securityDomain = (SecurityDomain) advisor.resolveAnnotation(SecurityDomain.class); if (securityDomain != null) { String domainName = securityDomain.value(); domain = SecurityDomainManager.getSecurityManager(domainName, ctx); } } catch (NamingException e) { throw new RuntimeException(e); } Interceptor interceptor = new NullInterceptor(); if (domain != null) { interceptor = new RunAsSecurityInterceptorv2(container, getRunAsIdentity(container)); } return interceptor; } }