<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 04/06/2021 05:22, Peter Firmstone
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:d771015f-a80c-0ce6-e2b5-3eafc9f8490e@zeus.net.au">
      
      <div data-reddit-rtjson="{"entityMap":{},"blocks":[{"key":"6e92m","text":"Could
        you please advise the recommended way now to access the logged
        in Subject to establish a TLS
connection?","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"33i5a","text":"I
        am unable to find the
documentation.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"fqp4m","text":"We
        use Executors and we preserve the calling Subject across them,
        to use for authentication our TLS
endpoints.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"4m548","text":"This
        is now deprecated in Java
17.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"boi99","text":"I
        would like to do this in a way that's not
deprecated?","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]}">
        <div class="" data-block="true" data-editor="1f04e7" data-offset-key="8sk1g-0-0">
          <div data-offset-key="8sk1g-0-0" class="public-DraftStyleDefault-block
            public-DraftStyleDefault-ltr"><span data-offset-key="8sk1g-0-0"><span data-text="true">Could
                someone please advise the recommended way now to
                preserve the Subject in Executors to establish a TLS
                connection?</span></span></div>
          <div data-offset-key="8sk1g-0-0" class="public-DraftStyleDefault-block
            public-DraftStyleDefault-ltr"><span data-offset-key="8sk1g-0-0"><span data-text="true"><br>
              </span></span></div>
        </div>
      </div>
    </blockquote>
    I think the primitive you are looking for is scope local variables.
    It's still in the exploration phase but there is a draft JEP [1].
    I'm quite sure that if we did this 20 years ago then Subject.doAs
    and friends would be different.<br>
    <br>
    -Alan<br>
    <br>
    [1] <a class="moz-txt-link-freetext" href="http://openjdk.java.net/jeps/8263012">http://openjdk.java.net/jeps/8263012</a><br>
  </body>
</html>