public String encodeToken(SecurityToken token) throws SecurityTokenException { if (! (token instanceof BlobCrypterSecurityToken)) { throw new SecurityTokenException("Can only encode BlogCrypterSecurityTokens"); } BlobCrypterSecurityToken t = (BlobCrypterSecurityToken)token; try { return t.encrypt(); } catch (BlobCrypterException e) { throw new SecurityTokenException(e); } } }
public AnonymousSecurityToken(String container, Long moduleId, String appUrl) { setContainer(container).setModuleId(moduleId).setAppUrl(appUrl) .setOwnerId(ANONYMOUS_ID) .setViewerId(ANONYMOUS_ID) .setDomain("*") .setTrustedJson(""); }
public static BlobCrypterSecurityToken fromToken(SecurityToken token) { BlobCrypterSecurityToken interpretedToken = new BlobCrypterSecurityToken(token.getContainer(), token.getDomain(), token.getActiveUrl(), null); interpretedToken .setAppId(token.getAppId()) .setAppUrl(token.getAppUrl()) .setExpiresAt(token.getExpiresAt()) .setModuleId(token.getModuleId()) .setOwnerId(token.getOwnerId()) .setTrustedJson(token.getTrustedJson()) .setViewerId(token.getViewerId()); return interpretedToken; } }
public SecurityToken getSecurityTokenFromRequest(HttpServletRequest request) throws InvalidAuthenticationException { Map<String, String> parameters = getMappedParameters(request); try { if (parameters.get(SecurityTokenCodec.SECURITY_TOKEN_NAME) == null) { return null; } return securityTokenCodec.createToken(parameters); } catch (SecurityTokenException e) { throw new InvalidAuthenticationException("Malformed security token " + parameters.get(SecurityTokenCodec.SECURITY_TOKEN_NAME), e); } }
public String encodeToken(SecurityToken token) throws SecurityTokenException { if (token == null) { return null; } return codec.encodeToken(token); } }
/** * Get the security token for this request. * * @return The security token */ public SecurityToken getSecurityToken() { return AuthInfoUtil.getSecurityTokenFromRequest(req); }
/** * A helper to help load known supported keys from a provided map. * * @param map The map of values. * @see #getMapKeys() * @see #toMap() */ protected AbstractSecurityToken loadFromMap(Map<String, String> map) { for (Keys key : getMapKeys()) { key.loadFromMap(this, map); } return this; }
/** * Set the auth type for the request. * * @param authType The named auth type * @return This object */ AuthInfo setAuthType(String authType) { setRequestAttribute(req, Attribute.AUTH_TYPE, authType); return this; }
/** * Set the security token for the request. * * @param req The request object * @param token The security token */ public static void setSecurityTokenForRequest(HttpServletRequest req, SecurityToken token) { setRequestAttribute(req, Attribute.SECURITY_TOKEN, token); }
/** * Compute and set the expiration time for this token using the default TTL. * * @return This security token. * @see #setExpires(int) */ protected AbstractSecurityToken setExpires() { return setExpires(DEFAULT_MAX_TOKEN_TTL); }
public static BlobCrypterSecurityToken fromToken(SecurityToken token) { BlobCrypterSecurityToken interpretedToken = new BlobCrypterSecurityToken(token.getContainer(), token.getDomain(), token.getActiveUrl(), null); interpretedToken .setAppId(token.getAppId()) .setAppUrl(token.getAppUrl()) .setExpiresAt(token.getExpiresAt()) .setModuleId(token.getModuleId()) .setOwnerId(token.getOwnerId()) .setTrustedJson(token.getTrustedJson()) .setViewerId(token.getViewerId()); return interpretedToken; } }
public AnonymousSecurityToken(String container, Long moduleId, String appUrl) { setContainer(container).setModuleId(moduleId).setAppUrl(appUrl) .setOwnerId(ANONYMOUS_ID) .setViewerId(ANONYMOUS_ID) .setDomain("*") .setTrustedJson(""); }
public String encodeToken(SecurityToken token) throws SecurityTokenException { if (! (token instanceof BlobCrypterSecurityToken)) { throw new SecurityTokenException("Can only encode BlogCrypterSecurityTokens"); } BlobCrypterSecurityToken t = (BlobCrypterSecurityToken)token; try { return t.encrypt(); } catch (BlobCrypterException e) { throw new SecurityTokenException(e); } } }
/** * A helper to help load known supported keys from a provided map. * * @param map The map of values. * @see #getMapKeys() * @see #toMap() */ protected AbstractSecurityToken loadFromMap(Map<String, String> map) { for (Keys key : getMapKeys()) { key.loadFromMap(this, map); } return this; }
/** * Set the security token for the request. * * @param token The security token * @return This object */ AuthInfo setSecurityToken(SecurityToken token) { setRequestAttribute(req, Attribute.SECURITY_TOKEN, token); return this; }
/** * Set the auth type for the request. * * @param req The request object * @param authType The named auth type */ public static void setAuthTypeForRequest(HttpServletRequest req, String authType) { setRequestAttribute(req, Attribute.AUTH_TYPE, authType); }
public static BlobCrypterSecurityToken fromToken(SecurityToken token) { BlobCrypterSecurityToken interpretedToken = new BlobCrypterSecurityToken(token.getContainer(), token.getDomain(), token.getActiveUrl(), null); interpretedToken .setAppId(token.getAppId()) .setAppUrl(token.getAppUrl()) .setExpiresAt(token.getExpiresAt()) .setModuleId(token.getModuleId()) .setOwnerId(token.getOwnerId()) .setTrustedJson(token.getTrustedJson()) .setViewerId(token.getViewerId()); return interpretedToken; } }
public AnonymousSecurityToken(String container, Long moduleId, String appUrl) { setContainer(container).setModuleId(moduleId).setAppUrl(appUrl) .setOwnerId(ANONYMOUS_ID) .setViewerId(ANONYMOUS_ID) .setDomain("*") .setTrustedJson(""); }
/** * A helper to help load known supported keys from a provided map. * * @param map The map of values. * @see #getMapKeys() * @see #toMap() */ protected AbstractSecurityToken loadFromMap(Map<String, String> map) { for (Keys key : getMapKeys()) { key.loadFromMap(this, map); } return this; }
/** * Set the auth type for the request. * * @param authType The named auth type * @return This object */ AuthInfo setAuthType(String authType) { setRequestAttribute(req, Attribute.AUTH_TYPE, authType); return this; }