@Test void validate_invalid_bindingId_test() { byte[] bindingId = new byte[]{0x01, 0x23, 0x45}; byte[] invalidBindingId = new byte[]{0x00, 0x00, 0x00}; TokenBinding tokenBinding = new TokenBinding(TokenBindingStatus.PRESENT, bindingId); assertThrows(TokenBindingException.class, () -> target.validate(tokenBinding, invalidBindingId) ); }
public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) { if (clientDataTokenBinding == null) { } else { byte[] clientDataTokenBindingId; if (clientDataTokenBinding.getId() == null) { clientDataTokenBindingId = null; } else { clientDataTokenBindingId = Base64UrlUtil.decode(clientDataTokenBinding.getId()); } switch (clientDataTokenBinding.getStatus()) { case NOT_SUPPORTED: break; case SUPPORTED: break; case PRESENT: if (!Arrays.equals(clientDataTokenBindingId, serverTokenBindingId)) { throw new TokenBindingException("TokenBinding id does not match"); } } } }
TokenBindingValidator { public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) { if (clientDataTokenBinding == null) { } else { byte[] clientDataTokenBindingId; if (clientDataTokenBinding.getId() == null) { clientDataTokenBindingId = null; } else { clientDataTokenBindingId = Base64UrlUtil.decode(clientDataTokenBinding.getId()); } switch (clientDataTokenBinding.getStatus()) { case NOT_SUPPORTED: break; case SUPPORTED: break; case PRESENT: if (!Arrays.equals(clientDataTokenBindingId, serverTokenBindingId)) { throw new TokenBindingException("TokenBinding id does not match"); } } } } }
TokenBindingValidator { public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) { if (clientDataTokenBinding == null) { } else { byte[] clientDataTokenBindingId; if (clientDataTokenBinding.getId() == null) { clientDataTokenBindingId = null; } else { clientDataTokenBindingId = Base64UrlUtil.decode(clientDataTokenBinding.getId()); } switch (clientDataTokenBinding.getStatus()) { case NOT_SUPPORTED: break; case SUPPORTED: break; case PRESENT: if (!Arrays.equals(clientDataTokenBindingId, serverTokenBindingId)) { throw new TokenBindingException("TokenBinding id does not match"); } } } }  }
TokenBindingValidator { public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) { if (clientDataTokenBinding == null) { } else { byte[] clientDataTokenBindingId; if (clientDataTokenBinding.getId() == null) { clientDataTokenBindingId = null; } else { clientDataTokenBindingId = Base64UrlUtil.decode(clientDataTokenBinding.getId()); } switch (clientDataTokenBinding.getStatus()) { case NOT_SUPPORTED: break; case SUPPORTED: break; case PRESENT: if (!Arrays.equals(clientDataTokenBindingId, serverTokenBindingId)) { throw new TokenBindingException("TokenBinding id does not match"); } } } }  void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId); }
TokenBindingValidator { public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) { if (clientDataTokenBinding == null) { } else { byte[] clientDataTokenBindingId; if (clientDataTokenBinding.getId() == null) { clientDataTokenBindingId = null; } else { clientDataTokenBindingId = Base64UrlUtil.decode(clientDataTokenBinding.getId()); } switch (clientDataTokenBinding.getStatus()) { case NOT_SUPPORTED: break; case SUPPORTED: break; case PRESENT: if (!Arrays.equals(clientDataTokenBindingId, serverTokenBindingId)) { throw new TokenBindingException("TokenBinding id does not match"); } } } }  void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId);  }