protected OAuth2Token internalCreateToken() { return new OAuth2TokenPersistence(this.encrypter); }
public OAuth2Token createToken() { return new OAuth2TokenPersistence(this.encrypter); }
protected static OAuth2TokenPersistence getAccessToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getAccessToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getBadMacToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_256); accessToken.setMacExt("1 2 3"); accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8")); accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getMacToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_1); accessToken.setMacExt("1 2 3"); accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8")); accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getBadMacToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_256); accessToken.setMacExt("1 2 3"); accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8")); accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getMacToken() throws Exception { final OAuth2TokenPersistence accessToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); MockUtils.setTokenCommons(accessToken); accessToken.setMacAlgorithm(OAuth2Message.HMAC_SHA_1); accessToken.setMacExt("1 2 3"); accessToken.setMacSecret(MockUtils.MAC_SECRET.getBytes("UTF-8")); accessToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); accessToken.setType(OAuth2Token.Type.ACCESS); return accessToken; }
protected static OAuth2TokenPersistence getRefreshToken() throws Exception { final OAuth2TokenPersistence refreshToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); refreshToken.setExpiresAt(1L); refreshToken.setGadgetUri(MockUtils.GADGET_URI1); refreshToken.setIssuedAt(0L); refreshToken.setMacAlgorithm(""); refreshToken.setMacExt(""); refreshToken.setMacSecret(new byte[] {}); refreshToken.setProperties(MockUtils.EMPTY_MAP); refreshToken.setScope(MockUtils.SCOPE); refreshToken.setSecret(MockUtils.ACCESS_SECRET.getBytes("UTF-8")); refreshToken.setServiceName(MockUtils.SERVICE_NAME); refreshToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); refreshToken.setType(OAuth2Token.Type.REFRESH); refreshToken.setUser(MockUtils.USER); return refreshToken; }
protected static OAuth2TokenPersistence getRefreshToken() throws Exception { final OAuth2TokenPersistence refreshToken = new OAuth2TokenPersistence( MockUtils.getDummyEncrypter()); refreshToken.setExpiresAt(1L); refreshToken.setGadgetUri(MockUtils.GADGET_URI1); refreshToken.setIssuedAt(0L); refreshToken.setMacAlgorithm(""); refreshToken.setMacExt(""); refreshToken.setMacSecret(new byte[] {}); refreshToken.setProperties(MockUtils.EMPTY_MAP); refreshToken.setScope(MockUtils.SCOPE); refreshToken.setSecret(MockUtils.ACCESS_SECRET.getBytes("UTF-8")); refreshToken.setServiceName(MockUtils.SERVICE_NAME); refreshToken.setTokenType(OAuth2Message.MAC_TOKEN_TYPE); refreshToken.setType(OAuth2Token.Type.REFRESH); refreshToken.setUser(MockUtils.USER); return refreshToken; }
@Test public void testEquals_1() throws Exception { final OAuth2TokenPersistence obj = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); obj.setServiceName(MockUtils.SERVICE_NAME); obj.setUser(MockUtils.USER); obj.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); obj.setIssuedAt(0L); obj.setEncryptedMacSecret(new byte[] {}); obj.setMacAlgorithm(""); obj.setScope(MockUtils.SCOPE); obj.setExpiresAt(1L); obj.setMacSecret(new byte[] {}); obj.setSecret(new byte[] {}); obj.setGadgetUri(MockUtils.GADGET_URI1); obj.setMacExt(""); obj.setTokenType(OAuth2Message.BEARER_TOKEN_TYPE); final boolean result = OAuth2TokenPersistenceTest.accessToken.equals(obj); Assert.assertTrue(result); }
@Test public void testEquals_1() throws Exception { final OAuth2TokenPersistence obj = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); obj.setServiceName(MockUtils.SERVICE_NAME); obj.setUser(MockUtils.USER); obj.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); obj.setIssuedAt(0L); obj.setEncryptedMacSecret(new byte[] {}); obj.setMacAlgorithm(""); obj.setScope(MockUtils.SCOPE); obj.setExpiresAt(1L); obj.setMacSecret(new byte[] {}); obj.setSecret(new byte[] {}); obj.setGadgetUri(MockUtils.GADGET_URI1); obj.setMacExt(""); obj.setTokenType(OAuth2Message.BEARER_TOKEN_TYPE); final boolean result = OAuth2TokenPersistenceTest.accessToken.equals(obj); Assert.assertTrue(result); }
@Test public void testSetEncryptedSecret_2() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final byte[] encryptedSecret = new byte[] {}; fixture.setEncryptedSecret(encryptedSecret); }
@Test public void testSetType_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final org.apache.shindig.gadgets.oauth2.OAuth2Token.Type type = org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS; fixture.setType(type); }
@Test public void testSetUser_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final String user = ""; fixture.setUser(user); }
@Test public void testSetMacExt_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final String macExt = ""; fixture.setMacExt(macExt); }
@Test public void testSetMacSecret_2() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final byte[] secret = new byte[] {}; fixture.setMacSecret(secret); }
@Test public void testSetServiceName_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final String serviceName = ""; fixture.setServiceName(serviceName); }
@Test public void testSetTokenType_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final String tokenType = ""; fixture.setTokenType(tokenType); }
@Test public void testSetMacAlgorithm_1() throws Exception { final OAuth2TokenPersistence fixture = new OAuth2TokenPersistence(MockUtils.getDummyEncrypter()); fixture.setServiceName(""); fixture.setEncryptedSecret(new byte[] {}); fixture.setUser(""); fixture.setType(org.apache.shindig.gadgets.oauth2.OAuth2Token.Type.ACCESS); fixture.setIssuedAt(1L); fixture.setEncryptedMacSecret(new byte[] {}); fixture.setMacAlgorithm(""); fixture.setScope(""); fixture.setExpiresAt(1L); fixture.setMacSecret(new byte[] {}); fixture.setSecret(new byte[] {}); fixture.setGadgetUri(""); fixture.setMacExt(""); fixture.setTokenType(""); final String algorithm = ""; fixture.setMacAlgorithm(algorithm); }