Package org.jboss.soa.esb.services.security

Examples of org.jboss.soa.esb.services.security.SecurityService


                         */
                    LOGGER.debug(securityContext);
                    }
                }

          final SecurityService securityService = SecurityServiceFactory.getSecurityService();

          final String moduleName = securityConf.getModuleName() ;
            if (securityContext == null || !securityContext.isValid() || ((moduleName != null) && !moduleName.equals(securityContext.getDomain())))
            {
                if (authRequest == null)
                {
                    throw new SecurityServiceException("Service '" + serviceName + "' has been configured for security but no AuthenticationRequest could be located in the Message Context. Cannot authenticate without an AuthenticationRequest.");
                }

                 // No existing security context exist or it had expired. Create a new one to drive the autentication.
                securityContext = new SecurityContext(new Subject(), getSecurityContextTimeout(securityConf), moduleName);

                // Authenticate the caller
              securityService.authenticate(securityConf, securityContext, authRequest);

                // Store the encrypted security context. Will be re-attached to outgoing messages.
              SecurityContext.setSecurityContext(SecurityContext.encryptContext(securityContext));
            }

            // Check that the caller is a member of atleast one of the declared roles.
            if (!securityService.checkRolesAllowed(securityConf.getRolesAllowed(), securityContext))
            {
              throw new SecurityServiceException("Caller did not belong to any of the rolesAllowed " + securityConf.getRolesAllowed());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.services.security.SecurityService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.