Package org.jboss.wsf.spi.invocation

Examples of org.jboss.wsf.spi.invocation.SecurityAdaptor


         throw new IllegalStateException("Cannot obtain HandlerCallback");
      }

      // prepare security data
      final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      final SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      final Principal principal = securityAdaptor.getPrincipal();
      final Object credential = securityAdaptor.getCredential();

      // prepare invocation data
      final Method method = wsInvocation.getJavaMethod();
      final Object[] args = wsInvocation.getArgs();
      final org.jboss.invocation.Invocation jbossInvocation = new org.jboss.invocation.Invocation(null, method, args,
View Full Code Here


         try
         {
            log.debug("Attempting to add the security Credentials to the current Request");

            SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
            SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();

            if (securityAdaptor != null && securityAdaptor.getPrincipal() != null && securityAdaptor.getPrincipal().getName() != null && securityAdaptor.getCredential() != null)
            {
               WebAuthentication wa = new WebAuthentication();
               wa.login(securityAdaptor.getPrincipal().getName(), securityAdaptor.getCredential());
            }
            else
            {
               log.debug("No securityAdaptor available. Cannot add credentials from the WS Security");
            }
View Full Code Here

      MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class);
      if (msgContext == null)
         throw new IllegalStateException("Cannot obtain MessageContext");

      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      Principal principal = securityAdaptor.getPrincipal();
      Object credential = securityAdaptor.getCredential();

      if (principal == null && sc != null)
         principal = sc.getUtil().getUserPrincipal();

      if (credential == null && sc != null)
View Full Code Here

      MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class);
      if (msgContext == null)
         throw new IllegalStateException("Cannot obtain MessageContext");

      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      Principal principal = securityAdaptor.getPrincipal();
      Object credential = securityAdaptor.getCredential();

      if (principal == null && sc != null)
         principal = sc.getUtil().getUserPrincipal();

      if (credential == null && sc != null)
View Full Code Here

   }

   public void process(Document message, Token token) throws WSSecurityException
   {
      UsernameToken user = (UsernameToken)token;
      SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();

      if (user.isDigest())
      {
         verifyUsernameToken(user);
         CallbackHandler handler = new UsernameTokenCallbackHandler(user.getNonce(), user.getCreated());
         CallbackHandlerPolicyContextHandler.setCallbackHandler(handler);
      }
      securityAdaptor.setPrincipal(new SimplePrincipal(user.getUsername()));
      securityAdaptor.setCredential(user.getPassword());
   }
View Full Code Here

      if (TRACE)
         log.trace("About to check authorization, using security domain '" + am.getSecurityDomain() + "'");

      // Step 1 - Authenticate using currently associated principals.
      SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
      Principal principal = securityAdaptor.getPrincipal();
      Object credential = securityAdaptor.getCredential();

      Subject subject = new Subject();

      if (am.isValid(principal, credential, subject) == false)
      {
         String msg = "Authentication failed, principal=" + principal;
         log.error(msg);
         SecurityException e = new SecurityException(msg);
         throw new FailedAuthenticationException(e);
      }

      securityAdaptor.pushSubjectContext(subject, principal, credential);

      if (TRACE)
         log.trace("Authenticated, principal=" + principal);

      // Step 2 - If unchecked all ok so return.
View Full Code Here

      {
         throw new IllegalArgumentException("Token " + token + " is not a X509Token!");
      }
      X509Certificate cert = ((X509Token)token).getCert();
      Principal principal = certMapping.toPrinicipal(new X509Certificate[] { cert });
      SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
      securityAdaptor.setPrincipal(principal);
      securityAdaptor.setCredential(cert);

   }
View Full Code Here

   {
      Principal prevUsername = null;
      Object prevPassword = null;

      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      if (username != null || password != null)
      {
         prevUsername = securityAdaptor.getPrincipal();
         prevPassword = securityAdaptor.getCredential();
         securityAdaptor.setPrincipal(new SimplePrincipal(username));
         securityAdaptor.setCredential(password);
      }

      try
      {
         server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url }, new String[] { "java.net.URL" });
      }
      finally
      {
         if (username != null || password != null)
         {
            securityAdaptor.setPrincipal(prevUsername);
            securityAdaptor.setCredential(prevPassword);
         }
      }
   }
View Full Code Here

   }

   public void process(Document message, Token token) throws WSSecurityException
   {
      UsernameToken user = (UsernameToken)token;
      SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
      securityAdaptor.setPrincipal(new SimplePrincipal(user.getUsername()));
      securityAdaptor.setCredential(user.getPassword());
   }
View Full Code Here

   {
      Principal prevUsername = null;
      Object prevPassword = null;

      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      if (username != null || password != null)
      {
         prevUsername = securityAdaptor.getPrincipal();
         prevPassword = securityAdaptor.getCredential();
         securityAdaptor.setPrincipal(new SimplePrincipal(username));
         securityAdaptor.setCredential(password);
      }

      try
      {
         server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url }, new String[] { "java.net.URL" });
      }
      finally
      {
         if (username != null || password != null)
         {
            securityAdaptor.setPrincipal(prevUsername);
            securityAdaptor.setCredential(prevPassword);
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.wsf.spi.invocation.SecurityAdaptor

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.