Package org.jboss.resteasy.skeleton.key

Examples of org.jboss.resteasy.skeleton.key.SkeletonKeySession


      request.setUserPrincipal(principal);
      request.setAuthType("OAUTH");
      Session session = request.getSessionInternal();
      if (session != null && !remoteSkeletonKeyConfig.isCancelPropagation())
      {
         SkeletonKeySession skSession = (SkeletonKeySession) session.getNote(SkeletonKeySession.class.getName());
         if (skSession != null)
         {
            request.setAttribute(SkeletonKeySession.class.getName(), skSession);
            ResteasyProviderFactory.pushContext(SkeletonKeySession.class, skSession);
View Full Code Here


         Session session = request.getSessionInternal(true);
         session.setPrincipal(principal);
         session.setAuthType("OAUTH");
         if (!remoteSkeletonKeyConfig.isCancelPropagation())
         {
            SkeletonKeySession skSession = new SkeletonKeySession(oauth.getTokenString(), realmConfiguration.getMetadata());
            session.setNote(SkeletonKeySession.class.getName(), skSession);
         }

         String username = token.getPrincipal();
         log.debug("userSessionManage.login: " + username);
View Full Code Here

      principal = new CatalinaSecurityContextHelper().createPrincipal(request.getContext().getRealm(), skeletonKeyPrincipal, roles);
      request.setUserPrincipal(principal);
      request.setAuthType("OAUTH_BEARER");
      if (propagateToken)
      {
         SkeletonKeySession skSession = new SkeletonKeySession(tokenString, resourceMetadata);
         request.setAttribute(SkeletonKeySession.class.getName(), skSession);
         ResteasyProviderFactory.pushContext(SkeletonKeySession.class, skSession);
      }

      return true;
View Full Code Here


      try
      {
         SkeletonKeyToken token = RSATokenVerifier.verifyToken(tokenString, resourceMetadata);
         SkeletonKeySession skSession = new SkeletonKeySession(tokenString, resourceMetadata);
         ResteasyProviderFactory.pushContext(SkeletonKeySession.class, skSession);
         String callerPrincipal = securityContext.getUserPrincipal() != null ? securityContext.getUserPrincipal().getName() : null;

         final SkeletonKeyPrincipal principal = new SkeletonKeyPrincipal(token.getPrincipal(), callerPrincipal);
         final boolean isSecure = securityContext.isSecure();
View Full Code Here

         // propagate the skeleton key token string?
         if (!skeletonKeyConfig.isCancelPropagation())
         {
            if (request.getAttribute(SkeletonKeySession.class.getName()) == null && request.getSessionInternal() != null)
            {
               SkeletonKeySession skSession = (SkeletonKeySession) request.getSessionInternal().getNote(SkeletonKeySession.class.getName());
               if (skSession != null)
               {
                  request.setAttribute(SkeletonKeySession.class.getName(), skSession);
                  ResteasyProviderFactory.pushContext(SkeletonKeySession.class, skSession);
               }
View Full Code Here

         GenericPrincipal gp = (GenericPrincipal) request.getPrincipal();
         if (gp != null)
         {
            SkeletonKeyToken token = buildToken(gp);
            String stringToken = buildTokenString(realmPrivateKey, token);
            SkeletonKeySession skSession = new SkeletonKeySession(stringToken, resourceMetadata);
            request.setAttribute(SkeletonKeySession.class.getName(), skSession);
            ResteasyProviderFactory.pushContext(SkeletonKeySession.class, skSession);
            request.getSessionInternal(true).setNote(SkeletonKeySession.class.getName(), skSession);
         }
      }
View Full Code Here

*/
public class ProductDatabaseClient
{
   public static List<String> getProducts(HttpServletRequest request)
   {
      SkeletonKeySession session = (SkeletonKeySession)request.getAttribute(SkeletonKeySession.class.getName());
      ResteasyProviderFactory factory = new ResteasyProviderFactory();
      RegisterBuiltin.register(factory);
      ResteasyClient client = new ResteasyClientBuilder()
//                 .providerFactory(factory)
                 .trustStore(session.getMetadata().getTruststore())
                 .hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY).build();
      try
      {
         Response response = client.target("https://localhost:8443/database/products").request()
                 .header(HttpHeaders.AUTHORIZATION, "Bearer " + session.getToken()).get();
         return response.readEntity(new GenericType<List<String>>(){});
      }
      finally
      {
         client.close();
View Full Code Here

*/
public class CustomerDatabaseClient
{
   public static List<String> getCustomers(HttpServletRequest request)
   {
      SkeletonKeySession session = (SkeletonKeySession)request.getAttribute(SkeletonKeySession.class.getName());
      ResteasyClient client = new ResteasyClientBuilder()
                 .trustStore(session.getMetadata().getTruststore())
                 .hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY).build();
      try
      {
         Response response = client.target("https://localhost:8443/database/customers").request()
                 .header(HttpHeaders.AUTHORIZATION, "Bearer " + session.getToken()).get();
         return response.readEntity(new GenericType<List<String>>(){});
      }
      finally
      {
         client.close();
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.skeleton.key.SkeletonKeySession

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.