@Test public void testFromBase64EncodedPolicy() throws UnsupportedEncodingException { String examplePolicy = "{\"Statement\": {\"Resource\":\"http: Policy policy = PolicyUtils.fromBase64EncodedPolicy(PolicyUtils.base64Encode(examplePolicy)); assertEquals("http: assertEquals(EXAMPLE_IP, policy.getClientIpAddress().get().getHostAddress()); DateTime after = new DateTime(2015, 02, 28, 00, 46, 19, 0, DateTimeZone.UTC); after = after.withSecondOfMinute(19); assertEquals(after, policy.getValidFrom().get()); DateTime before = new DateTime(2015, 03, 01, 00, 46, 17, 0, DateTimeZone.UTC); assertEquals(before, policy.getValidUntil()); }
public static Policy fromBase64EncodedPolicy(String encodedPolicy) { String decodedPolicyString = base64Decode(encodedPolicy); return fromJson(decodedPolicyString); }
PolicyUtils { public static Policy fromBase64EncodedPolicy(String encodedPolicy) { String decodedPolicyString = base64Decode(encodedPolicy); return fromJson(decodedPolicyString); } }
PolicyUtils { public static Policy fromBase64EncodedPolicy(String encodedPolicy) { String decodedPolicyString = base64Decode(encodedPolicy); return fromJson(decodedPolicyString); } private  PolicyUtils(); }
PolicyUtils { public static Policy fromBase64EncodedPolicy(String encodedPolicy) { String decodedPolicyString = base64Decode(encodedPolicy); return fromJson(decodedPolicyString); } private  PolicyUtils(); static String base64Encode(String value); static String base64Decode(String value); static Policy fromJson(String policyJson); @SuppressWarnings("unchecked") static JSONObject toJson(Policy policy); static Policy fromBase64EncodedPolicy(String encodedPolicy); static String toBase64EncodedPolicy(Policy policy); static String getPolicySignature(Policy policy, String encryptionKey); }
PolicyUtils { public static Policy fromBase64EncodedPolicy(String encodedPolicy) { String decodedPolicyString = base64Decode(encodedPolicy); return fromJson(decodedPolicyString); } private  PolicyUtils(); static String base64Encode(String value); static String base64Decode(String value); static Policy fromJson(String policyJson); @SuppressWarnings("unchecked") static JSONObject toJson(Policy policy); static Policy fromBase64EncodedPolicy(String encodedPolicy); static String toBase64EncodedPolicy(Policy policy); static String getPolicySignature(Policy policy, String encryptionKey);  }