Package org.apache.shindig.auth

Examples of org.apache.shindig.auth.BlobCrypterSecurityToken


    @Override
    public String getEncryptedSecurityToken(RegionWidget regionWidget, Widget widget) throws SecurityTokenException {
        String encryptedToken = null;

        try {
            BlobCrypterSecurityToken securityToken = this.getBlobCrypterSecurityToken(regionWidget, widget);
            encryptedToken = this.encryptSecurityToken(securityToken);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from regionWidget", e);
        }
View Full Code Here


            //Remove the header container string and :
            encryptedSecurityToken = encryptedSecurityToken.substring((container + ":").length());

            //Decrypt
            Map<String, String> values = blobCrypter.unwrap(encryptedSecurityToken);
            securityToken = new BlobCrypterSecurityToken(container, domain, null, values);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from encrypted string: " +
                    encryptedSecurityToken, e);
        }
View Full Code Here

    @Override
    public String getEncryptedSecurityToken(String moduleId, String url, String ownerId) {
        String encryptedToken;

        try {
            BlobCrypterSecurityToken securityToken = this.getBlobCrypterSecurityToken(url, moduleId,  ownerId, userService.getAuthenticatedUser());
            encryptedToken = this.encryptSecurityToken(securityToken);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from regionWidget", e);
        }
View Full Code Here

        String moduleUrl = widget != null ? widget.getUrl() : "";
        String moduleId = String.valueOf(regionWidget.getId());
        String ownerId = regionWidget.getRegion().getPage().getOwnerId();
        User user = userService.getAuthenticatedUser();

        BlobCrypterSecurityToken securityToken = getBlobCrypterSecurityToken(moduleUrl, moduleId, ownerId, user);

        if (logger.isTraceEnabled()) {
            logger.trace("Token created for regionWidget " + regionWidget.toString() + " and user " + user.toString());
        }
View Full Code Here

        values.put(AbstractSecurityToken.Keys.MODULE_ID.getKey(), moduleId);
        values.put(AbstractSecurityToken.Keys.OWNER.getKey(), String.valueOf(userService.getUserById(ownerId).getUsername()));
        values.put(AbstractSecurityToken.Keys.VIEWER.getKey(), String.valueOf(user.getUsername()));
        values.put(AbstractSecurityToken.Keys.TRUSTED_JSON.getKey(), "");
        values.put(AbstractSecurityToken.Keys.EXPIRES.getKey(), String.valueOf(System.currentTimeMillis() + (24 * 60 * 60 * 1000)));
        return new BlobCrypterSecurityToken(container, domain, null, values);
    }
View Full Code Here

   protected String createToken(String gadgetURL, String owner, String viewer, Long moduleId, String container)
   {
      try
      {
         BlobCrypterSecurityToken t = new BlobCrypterSecurityToken(getBlobCrypter(this.containerKey), container, null);

         t.setAppUrl(gadgetURL);
         t.setModuleId(moduleId);
         t.setOwnerId(owner);
         t.setViewerId(viewer);
         t.setTrustedJson("trusted");

         return t.encrypt();
      }
      catch (IOException e)
      {
         e.printStackTrace(); // To change body of catch statement use File |
         // Settings | File Templates.
View Full Code Here

    @Override
    public String getEncryptedSecurityToken(RegionWidget regionWidget) throws SecurityTokenException {
        String encryptedToken = null;

        try {
            BlobCrypterSecurityToken securityToken = this.getBlobCrypterSecurityToken(regionWidget);
            encryptedToken = this.encryptSecurityToken(securityToken);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from regionWidget", e);
        }
View Full Code Here

    private BlobCrypterSecurityToken getBlobCrypterSecurityToken(RegionWidget regionWidget)
            throws SecurityTokenException {
        User user = userService.getAuthenticatedUser();

        BlobCrypterSecurityToken securityToken = new BlobCrypterSecurityToken(blobCrypter, container, domain);
        securityToken.setAppUrl(regionWidget.getWidget().getUrl());
        securityToken.setModuleId(regionWidget.getId());
        securityToken.setOwnerId(String.valueOf(regionWidget.getRegion().getPage().getOwner().getId()));
        securityToken.setViewerId(String.valueOf(user.getId()));
        securityToken.setTrustedJson("");

        if (logger.isTraceEnabled()) {
            logger.trace("Token created for regionWidget " + regionWidget.toString() + " and user " + user.toString());
        }
View Full Code Here

    @Override
    public String getEncryptedSecurityToken(RegionWidget regionWidget) throws SecurityTokenException {
        String encryptedToken = null;

        try {
            BlobCrypterSecurityToken securityToken = this.getBlobCrypterSecurityToken(regionWidget);
            encryptedToken = this.encryptSecurityToken(securityToken);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from regionWidget", e);
        }
View Full Code Here

            //Remove the header container string and :
            encryptedSecurityToken = encryptedSecurityToken.substring((container + ":").length());

            //Decrypt
            Map<String, String> values = blobCrypter.unwrap(encryptedSecurityToken);
            securityToken = new BlobCrypterSecurityToken(container, domain, null, values);
        } catch (Exception e) {
            throw new SecurityTokenException("Error creating security token from encrypted string: " +
                    encryptedSecurityToken, e);
        }
View Full Code Here

TOP

Related Classes of org.apache.shindig.auth.BlobCrypterSecurityToken

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.