@Test public void testParseMalformed() throws Exception { String data = FileUtils.toString(FileUtils.resolveResourceAsStream(getClass(), "TCToken-malformed.xml")); data = PathSecurityParameters.fix(data); TCTokenParser parser = new TCTokenParser(); List<TCTokenType> tokens = parser.parse(data); TCTokenType t = tokens.get(0); assertEquals(t.getSessionIdentifier(), "3eab1b41ecc1ce5246acf6f4e275"); assertEquals(t.getServerAddress().toString(), "https://eid-ref.my-service.de:443"); assertEquals( t.getRefreshAddress().toString(), "https://eid.services.my.net:443/?sessionID=D9D6851A7C02167A5699DA57657664715F4D9C44E50A94F7A83909D24AFA997A"); assertEquals(t.getBinding(), "urn:liberty:paos:2006-08"); assertEquals( t.getPathSecurityParameters().getPSK(), StringUtils.toByteArray( "b7e9dd2ba2568c3c8d572aaadb3eebf7d4515e66d5fc2fd8e46626725a9abba2")); }
@Test(enabled = true) public void testParse() throws Exception { InputStream testFile = FileUtils.resolveResourceAsStream(getClass(), "TCToken.xml"); TCTokenParser parser = new TCTokenParser(); List<TCTokenType> tokens = parser.parse(testFile); TCTokenType t = tokens.get(0); assertEquals(t.getSessionIdentifier(), "3eab1b41ecc1ce5246acf6f4e2751234"); assertEquals(t.getServerAddress().toString(), "https://eid-ref.my-service.de:443"); assertEquals( t.getRefreshAddress().toString(), "https://eid.services.my.net:443/?sessionID=D9D6851A7C02167A5699DA57657664715F4D9C44E50A94F7A83909D24AFA997A"); assertEquals(t.getBinding(), "urn:liberty:paos:2006-08"); }