class TokenBindingValidator {

    public void validate(TokenBinding clientDataTokenBinding, byte[] serverTokenBindingId) {
        if (clientDataTokenBinding == null) {
            // nop
        } 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");
                    }
            }
        }
    }

}