Esempio n. 1
0
  public void testAuth3_nonce() throws Exception {

    AuthorizationRequest req =
        new AuthorizationRequest(
            "sqrl://example.com/sqrl?4095c8adfa51dabe30fe9f9474d3f91def620300e489e6853baa67bed5d5e0d4");
    String testReuslt = req.getNonce();
    assertEquals("4095c8adfa51dabe30fe9f9474d3f91def620300e489e6853baa67bed5d5e0d4", testReuslt);
  }
Esempio n. 2
0
 public void testQRlAddress() {
   // qrl://10.0.0.27/login/sqrlauth.php?nut=5f7d471e26450c1539fe73b7867a789abb0c7de6f4246f1e719d7b2830e73de2
   String qrlAddress =
       "qrl://10.0.0.27/login/sqrlauth.php?nut=5f7d471e26450c1539fe73b7867a789abb0c7de6f4246f1e719d7b2830e73de2";
   AuthorizationRequest req = new AuthorizationRequest(qrlAddress);
   assertEquals(true, req.isValid);
   assertEquals("10.0.0.27", req.domain);
   assertEquals(
       "5f7d471e26450c1539fe73b7867a789abb0c7de6f4246f1e719d7b2830e73de2", req.getNonce());
   assertTrue(req.getReturnURL().startsWith("http"));
 }
Esempio n. 3
0
 public void testQRlAddressSignatureSend() {
   // qrl://10.0.0.27/login/sqrlauth.php?nut=5f7d471e26450c1539fe73b7867a789abb0c7de6f4246f1e719d7b2830e73de2
   String qrlAddress =
       "qrl://10.0.0.27/login/sqrlauth.php?nut=393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299";
   AuthorizationRequest req = new AuthorizationRequest(qrlAddress);
   assertEquals(true, req.isValid);
   assertEquals("10.0.0.27", req.domain);
   assertEquals(
       "393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299", req.getNonce());
   assertTrue(req.getReturnURL().startsWith("http"));
   assertTrue(
       req.getReturnURL()
           .endsWith("nut=393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299"));
 }
Esempio n. 4
0
 public void testQRLAddressNewNut() {
   // qrl://10.0.0.27/login/sqrlauth.php?nut=5f7d471e26450c1539fe73b7867a789abb0c7de6f4246f1e719d7b2830e73de2
   String qrlAddress =
       "qrl://10.0.0.27/login/sqrlauth.php?nut=393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299";
   AuthorizationRequest req = new AuthorizationRequest(qrlAddress);
   assertEquals(true, req.isValid);
   assertEquals("10.0.0.27", req.domain);
   assertEquals(
       "393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299", req.getNonce());
   assertTrue(req.getReturnURL().startsWith("http"));
   assertTrue(
       req.getReturnURL()
           .endsWith("nut=393cbc323070c8281e05bd8554f8d8d409cd9c64267f358cac41c121b1720299"));
   String newNut = Helper.urlEncode(Helper.CreateRandom(32));
   AuthorizationRequest newnutaddress = req.getNewNut(newNut);
   assertTrue(newnutaddress.getReturnURL().startsWith("http"));
   assertTrue(newnutaddress.getReturnURL().endsWith(newNut));
   assertEquals(
       String.format("http://10.0.0.27/login/sqrlauth.php?nut=%s", newNut),
       newnutaddress.getReturnURL());
 }