Examples of SecurityAdaptor


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

   public void cleanup()
   {
      //Reset username/password since they're stored using a ThreadLocal
      SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
      SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
      securityAdaptor.setPrincipal(null);
      securityAdaptor.setCredential(null);
   }
View Full Code Here

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

   }

   public void process(Document message, Token token) throws WSSecurityException
   {
      UsernameToken user = (UsernameToken)token;
      SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
      Logger.getLogger(this.getClass()).info("Username: " + user.getUsername());
      Logger.getLogger(this.getClass()).info("Password: " + user.getPassword());
      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

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

   {
      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

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

      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();
      Principal principal = securityAdaptor.getPrincipal();
      Object credential = securityAdaptor.getCredential();

      Method method = inv.getJavaMethod();
      Object[] args = inv.getArgs();
      org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);
View Full Code Here

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

      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
TOP
Copyright © 2018 www.massapi.com. 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.