@Override
  public Code issueCode(Session session, IdTokenJWS idTokenJWS) {
    var code = IdGenerator.generateID();
    var value =
        new Code(
            code,
            clock.instant(),
            clock.instant().plus(TTL),
            session.redirectUri(),
            session.nonce(),
            session.clientId(),
            idTokenJWS);
    codeRepo.save(value);
    return value;
  }
@Test
  void issueCode_propagatesValues() {
    var issuer = URI.create("https://idp.example.com");
    var keyStore = mock(KeyStore.class);
    var codeRepo = mock(CodeRepo.class);

    var sut = new TokenIssuerImpl(issuer, keyStore, codeRepo);

    var nonce = UUID.randomUUID().toString();
    var redirectUri = URI.create("https://myapp.example.com/callback");
    var clientId = "myapp";

    var session = Session.create().nonce(nonce).redirectUri(redirectUri).clientId(clientId).build();

    // when
    var code = sut.issueCode(session, null);

    // then
    assertEquals(nonce, code.nonce());
    assertEquals(redirectUri, code.redirectUri());
    assertEquals(clientId, code.clientId());
  }