public static SecurityToken getSecurityToken(String owner, String viewer, String gadget) throws Exception { return new BasicSecurityToken(owner, viewer, "app", "container.com", gadget, "0", "default", GADGET_MAKE_REQUEST_URL, null); }
public BasicSecurityToken(String owner, String viewer, String app, String domain, String appUrl, String moduleId, String container, String activeUrl, Long expiresAt) throws BlobCrypterException { tokenData = Maps.newHashMapWithExpectedSize(7); putNullSafe(OWNER_KEY, owner); putNullSafe(VIEWER_KEY, viewer); putNullSafe(APP_KEY, app); putNullSafe(DOMAIN_KEY, domain); putNullSafe(APPURL_KEY, appUrl); putNullSafe(MODULE_KEY, moduleId); putNullSafe(CONTAINER_KEY, container); if (expiresAt != null) putNullSafe(EXPIRES_KEY, expiresAt.toString()); token = crypter.wrap(tokenData); this.activeUrl = activeUrl; }
public BasicSecurityToken(String owner, String viewer, String app, String domain, String appUrl, String moduleId, String container, String activeUrl, Long expiresAt) { setOwnerId(owner).setViewerId(viewer).setAppId(app).setDomain(domain).setAppUrl(appUrl); if (moduleId != null) setModuleId(Long.parseLong(moduleId)); setContainer(container).setActiveUrl(activeUrl).setExpiresAt(expiresAt); }
BasicSecurityToken basicToken = new BasicSecurityToken( Utf8UrlCoder.decode(tokens[OWNER_INDEX]), Utf8UrlCoder.decode(tokens[VIEWER_INDEX]), parameters.get(SecurityTokenCodec.ACTIVE_URL_NAME), expires); return basicToken.enforceNotExpired(); } catch (BlobCrypterException e) { throw new SecurityTokenException(e);
BasicSecurityToken basicToken = new BasicSecurityToken( Utf8UrlCoder.decode(tokens[OWNER_INDEX]), Utf8UrlCoder.decode(tokens[VIEWER_INDEX]), parameters.get(SecurityTokenCodec.ACTIVE_URL_NAME), expires); return basicToken.enforceNotExpired(); } catch (BlobCrypterException e) { throw new SecurityTokenException(e);
public static SecurityToken getSecurityToken(String owner, String viewer, String gadget) throws Exception { return new BasicSecurityToken(owner, viewer, "app", "container.com", gadget, "0", "default", GADGET_MAKE_REQUEST_URL, null); }
BasicSecurityToken basicToken = new BasicSecurityToken( Utf8UrlCoder.decode(tokens[OWNER_INDEX]), Utf8UrlCoder.decode(tokens[VIEWER_INDEX]), parameters.get(SecurityTokenCodec.ACTIVE_URL_NAME), expires); return basicToken.enforceNotExpired(); } catch (BlobCrypterException e) { throw new SecurityTokenException(e);
public BasicSecurityToken(String owner, String viewer, String app, String domain, String appUrl, String moduleId, String container, String activeUrl, Long expiresAt) { setOwnerId(owner).setViewerId(viewer).setAppId(app).setDomain(domain).setAppUrl(appUrl); if (moduleId != null) setModuleId(Long.parseLong(moduleId)); setContainer(container).setActiveUrl(activeUrl).setExpiresAt(expiresAt); }
public BasicSecurityToken(String owner, String viewer, String app, String domain, String appUrl, String moduleId, String container, String activeUrl, Long expiresAt) throws BlobCrypterException { tokenData = Maps.newHashMapWithExpectedSize(7); putNullSafe(OWNER_KEY, owner); putNullSafe(VIEWER_KEY, viewer); putNullSafe(APP_KEY, app); putNullSafe(DOMAIN_KEY, domain); putNullSafe(APPURL_KEY, appUrl); putNullSafe(MODULE_KEY, moduleId); putNullSafe(CONTAINER_KEY, container); if (expiresAt != null) putNullSafe(EXPIRES_KEY, expiresAt.toString()); token = crypter.wrap(tokenData); this.activeUrl = activeUrl; }
public static SecurityToken getSecurityToken(String owner, String viewer, String gadget) throws Exception { return new BasicSecurityToken(owner, viewer, "app", "container.com", gadget, "0", "default", GADGET_MAKE_REQUEST_URL, null); }
public BasicSecurityToken(String owner, String viewer, String app, String domain, String appUrl, String moduleId, String container, String activeUrl, Long expiresAt) { setOwnerId(owner).setViewerId(viewer).setAppId(app).setDomain(domain).setAppUrl(appUrl); if (moduleId != null) setModuleId(Long.parseLong(moduleId)); setContainer(container).setActiveUrl(activeUrl).setExpiresAt(expiresAt); }
return new BasicSecurityToken( Utf8UrlCoder.decode(tokens[OWNER_INDEX]), Utf8UrlCoder.decode(tokens[VIEWER_INDEX]),
return new BasicSecurityToken( Utf8UrlCoder.decode(tokens[OWNER_INDEX]), Utf8UrlCoder.decode(tokens[VIEWER_INDEX]),
@Before public void setup() throws Exception { expectedToken = new BasicSecurityToken( "owner", "viewer", "app", "domain", "appUrl", "0", "container", "activeUrl", 1000L); // Mock token codec codec = new SecurityTokenCodec() { public SecurityToken createToken(Map<String, String> tokenParameters) throws SecurityTokenException { return tokenParameters == null ? null : "1234".equals(tokenParameters.get(SecurityTokenCodec.SECURITY_TOKEN_NAME)) ? expectedToken : null; } public String encodeToken(SecurityToken token) throws SecurityTokenException { return null; } public int getTokenTimeToLive() { return 0; // Not used. } public int getTokenTimeToLive(String container) { return 0; // Not used. } }; authHandler = new UrlParameterAuthenticationHandler(codec, true); }
@Before public void setup() throws Exception { expectedToken = new BasicSecurityToken( "owner", "viewer", "app", "domain", "appUrl", "0", "container", "activeUrl", 1000L); // Mock token codec codec = new SecurityTokenCodec() { public SecurityToken createToken(Map<String, String> tokenParameters) throws SecurityTokenException { return tokenParameters == null ? null : "1234".equals(tokenParameters.get(SecurityTokenCodec.SECURITY_TOKEN_NAME)) ? expectedToken : null; } public String encodeToken(SecurityToken token) throws SecurityTokenException { return null; } public int getTokenTimeToLive() { return 0; // Not used. } public int getTokenTimeToLive(String container) { return 0; // Not used. } }; authHandler = new UrlParameterAuthenticationHandler(codec, true); }
@Before public void setup() throws Exception { expectedToken = new BasicSecurityToken( "owner", "viewer", "app", "domain", "appUrl", "0", "container", "activeUrl", 1000L); // Mock token codec codec = new SecurityTokenCodec() { public SecurityToken createToken(Map<String, String> tokenParameters) throws SecurityTokenException { return tokenParameters == null ? null : "1234".equals(tokenParameters.get(SecurityTokenCodec.SECURITY_TOKEN_NAME)) ? expectedToken : null; } public String encodeToken(SecurityToken token) throws SecurityTokenException { return null; } public int getTokenTimeToLive() { return 0; // Not used. } public int getTokenTimeToLive(String container) { return 0; // Not used. } }; authHandler = new UrlParameterAuthenticationHandler(codec, true); }
} else { AbstractSecurityToken localToken = new BasicSecurityToken(); if (tokenTTL != null) { localToken.setExpires(tokenTTL);
} else { AbstractSecurityToken localToken = new BasicSecurityToken(); if (tokenTTL != null) { localToken.setExpires(tokenTTL);
} else { AbstractSecurityToken localToken = new BasicSecurityToken(); if (tokenTTL != null) { localToken.setExpires(tokenTTL);
@Before public void setUp() throws Exception { control = EasyMock.createNiceControl(); processor = control.createMock(Processor.class); lockedDomainService = control.createMock(LockedDomainService.class); oauthUriManager = control.createMock(OAuthUriManager.class); stateCrypter = new BasicBlobCrypter("1111111111111111111".getBytes()); securityToken = new BasicSecurityToken("viewer", "viewer", "app", "container.com", "gadget", "0", "default", MAKE_REQUEST_URL, null); gadget = control.createMock(Gadget.class); fetcherConfig = new OAuthFetcherConfig(null, null, null, null, false); responseParams = new OAuthResponseParams(null, null, null); }