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")); }
public void testAuth() throws Exception { AuthorizationRequest req = new AuthorizationRequest( "https://localhost/sqrl?4095c8adfa51dabe30fe9f9474d3f91def620300e489e6853baa67bed5d5e0d4"); String testReuslt = req.getDomain(); assertEquals("localhost", testReuslt); req.fullNut = false; assertEquals("https://localhost/sqrl", req.getReturnURL()); }
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")); }
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()); }
public void testAuth3_wqithsqrl_picky() throws Exception { AuthorizationRequest req = new AuthorizationRequest( "sqrl://example.com/sqrl?4095c8adfa51dabe30fe9f9474d3f91def620300e489e6853baa67bed5d5e0d4"); String testReuslt = req.getDomain(); assertEquals("example.com", testReuslt); // if we understand how to construct a sqrl then we should expect to understand how to handle // the protocol req.isConnectionPicky = true; req.fullNut = false; assertEquals("https://example.com/sqrl", req.getReturnURL()); }