TCTokenVerifier { public void verifyPathSecurity() throws InvalidRedirectUrlException, InvalidTCTokenElement, InvalidTCTokenUrlException, SecurityViolationException, UserCancellationException { String proto = token.getPathSecurityProtocol(); TCTokenType.PathSecurityParameters psp = token.getPathSecurityParameters(); if ((checkEmpty(proto) && checkEmpty(psp))) { assertSameChannel("ServerAddress", token.getServerAddress()); return; } else if ((! checkEmpty(proto)) && "urn:ietf:rfc:4279".equals(proto) && checkEmpty(psp) && ! token.isInvalidPSK()) { assertSameChannel("ServerAddress", token.getServerAddress()); return; } assertRequired("PathSecurityProtocol", proto); String[] protos = {"urn:ietf:rfc:5246", "urn:ietf:rfc:4279"}; checkEqualOR("PathSecurityProtocol", proto, protos); if ("urn:ietf:rfc:4279".equals(proto)) { if (token.isInvalidPSK()) { String minor = ResultMinor.COMMUNICATION_ERROR; String errorUrl = token.getComErrorAddressWithParams(minor); determineRefreshAddress(new InvalidTCTokenElement(errorUrl, INVALID_ELEMENT, "PSK")); } try { assertRequired("PathSecurityParameters", psp); assertRequired("PSK", psp.getPSK()); } catch (InvalidTCTokenElement ex) { determineRefreshAddress(ex); } } } TCTokenVerifier(@Nonnull TCToken token, ResourceContext ctx); boolean isErrorToken(); void verifyUrlToken(); void verifyServerAddress(); void verifySessionIdentifier(); void verifyRefreshAddress(); void verifyCommunicationErrorAddress(); void verifyBinding(); void verifyPathSecurity();  }
@Test(expectedExceptions = InvalidTCTokenElement.class, enabled = false) public void testVerifyPathSecurityProtocol() throws ActivationError { token.setPathSecurityProtocol("urn:ietf:rfc:42791"); verifier.verifyPathSecurity(); }
@Test(expectedExceptions = InvalidTCTokenElement.class, enabled = false) public void testVerifyPathSecurityParameters() throws ActivationError { token.setPathSecurityProtocol("urn:ietf:rfc:4279"); token.setPathSecurityParameters(null); verifier.verifyPathSecurity(); }
@Test(expectedExceptions = InvalidTCTokenElement.class, enabled = false) public void testVerifyPathSecurityParameters2() throws ActivationError { TCTokenType.PathSecurityParameters psp = new TCTokenType.PathSecurityParameters(); psp.setPSK(null); token.setPathSecurityParameters(psp); verifier.verifyPathSecurity(); }