/** * 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); }
/** * 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); }
/** * 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); }
if (token instanceof AbstractSecurityToken) { if (tokenTTL != null) { ((AbstractSecurityToken) token).setExpires(tokenTTL); } else { ((AbstractSecurityToken) token).setExpires(); localToken.setExpires(tokenTTL); } else { localToken.setExpires();
if (token instanceof AbstractSecurityToken) { if (tokenTTL != null) { ((AbstractSecurityToken) token).setExpires(tokenTTL); } else { ((AbstractSecurityToken) token).setExpires(); localToken.setExpires(tokenTTL); } else { localToken.setExpires();
if (token instanceof AbstractSecurityToken) { if (tokenTTL != null) { ((AbstractSecurityToken) token).setExpires(tokenTTL); } else { ((AbstractSecurityToken) token).setExpires(); localToken.setExpires(tokenTTL); } else { localToken.setExpires();
/** * Encrypt and sign the token. The returned value is *not* web safe, it should be URL * encoded before being used as a form parameter. */ public String encodeToken(SecurityToken token) throws SecurityTokenException { if (!token.getAuthenticationMode().equals( AuthenticationMode.SECURITY_TOKEN_URL_PARAMETER.name())) { throw new SecurityTokenException("Can only encode BlobCrypterSecurityTokens"); } // Test code sends in real AbstractTokens, they have modified time sources in them so // that we can test token expiration, production tokens are proxied via the SecurityToken interface. AbstractSecurityToken aToken = token instanceof AbstractSecurityToken ? (AbstractSecurityToken)token : BlobCrypterSecurityToken.fromToken(token); BlobCrypter crypter = crypters.get(aToken.getContainer()); if (crypter == null) { throw new SecurityTokenException("Unknown container " + aToken.getContainer()); } try { Integer tokenTTL = this.tokenTTLs.get(aToken.getContainer()); if (tokenTTL != null) { aToken.setExpires(tokenTTL); } else { aToken.setExpires(); } return aToken.getContainer() + ':' + crypter.wrap(aToken.toMap()); } catch (BlobCrypterException e) { throw new SecurityTokenException(e); } }
/** * Encrypt and sign the token. The returned value is *not* web safe, it should be URL * encoded before being used as a form parameter. */ public String encodeToken(SecurityToken token) throws SecurityTokenException { if (!token.getAuthenticationMode().equals( AuthenticationMode.SECURITY_TOKEN_URL_PARAMETER.name())) { throw new SecurityTokenException("Can only encode BlobCrypterSecurityTokens"); } // Test code sends in real AbstractTokens, they have modified time sources in them so // that we can test token expiration, production tokens are proxied via the SecurityToken interface. AbstractSecurityToken aToken = token instanceof AbstractSecurityToken ? (AbstractSecurityToken)token : BlobCrypterSecurityToken.fromToken(token); BlobCrypter crypter = crypters.get(aToken.getContainer()); if (crypter == null) { throw new SecurityTokenException("Unknown container " + aToken.getContainer()); } try { Integer tokenTTL = this.tokenTTLs.get(aToken.getContainer()); if (tokenTTL != null) { aToken.setExpires(tokenTTL); } else { aToken.setExpires(); } return aToken.getContainer() + ':' + crypter.wrap(aToken.toMap()); } catch (BlobCrypterException e) { throw new SecurityTokenException(e); } }
/** * Encrypt and sign the token. The returned value is *not* web safe, it should be URL * encoded before being used as a form parameter. */ public String encodeToken(SecurityToken token) throws SecurityTokenException { if (!token.getAuthenticationMode().equals( AuthenticationMode.SECURITY_TOKEN_URL_PARAMETER.name())) { throw new SecurityTokenException("Can only encode BlobCrypterSecurityTokens"); } // Test code sends in real AbstractTokens, they have modified time sources in them so // that we can test token expiration, production tokens are proxied via the SecurityToken interface. AbstractSecurityToken aToken = token instanceof AbstractSecurityToken ? (AbstractSecurityToken)token : BlobCrypterSecurityToken.fromToken(token); BlobCrypter crypter = crypters.get(aToken.getContainer()); if (crypter == null) { throw new SecurityTokenException("Unknown container " + aToken.getContainer()); } try { Integer tokenTTL = this.tokenTTLs.get(aToken.getContainer()); if (tokenTTL != null) { aToken.setExpires(tokenTTL); } else { aToken.setExpires(); } return aToken.getContainer() + ':' + crypter.wrap(aToken.toMap()); } catch (BlobCrypterException e) { throw new SecurityTokenException(e); } }