Skip to content

Creating example for new TokenProvider plugin#153

Open
stuart-wells wants to merge 3 commits into
mainfrom
stuartwells/tokenproviderexample
Open

Creating example for new TokenProvider plugin#153
stuart-wells wants to merge 3 commits into
mainfrom
stuartwells/tokenproviderexample

Conversation

@stuart-wells

Copy link
Copy Markdown

TODO: Before merging, need to update go.mod to the actual release that TokenProvider is included with.

What was changed

Added samples for using JWT to auth replication/internode traffic

Why?

TokenProvider was added to OSS in temporalio/temporal@74a7108 and will soon be released. Prepping a sample for reference in setting up a server using the plugin.

Checklist

  1. How was this tested:
    Used samples to create local servers and ran validation against those servers.

  2. Any docs updates needed?
    Doc changes are already approved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new extensibility sample demonstrating how to plug in Temporal Server’s auth.TokenProvider to attach bearer tokens to outbound cross-cluster (replication) RPCs, along with dependency updates needed to consume the (pre-release) Temporal Server changes that introduced TokenProvider.

Changes:

  • Add a new extensibility/tokenprovider sample (provider implementation + standalone server wiring + tests + test config).
  • Update the extensibility index README to link the new TokenProvider sample.
  • Update extensibility/go.mod/go.sum to pin Temporal Server/API versions that include the new TokenProvider support, and adjust the authorizer claim-mapper TLS subject handling.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Adds a link to the new Token Provider sample.
extensibility/tokenprovider/README.md Documents the TokenProvider sample, caching behavior, and required config knobs.
extensibility/tokenprovider/myTokenProvider.go Implements a file-backed TokenProvider with expiry-aware caching via oauth2.ReuseTokenSource.
extensibility/tokenprovider/myTokenProvider_test.go Unit tests for file token reading, caching behavior, and JWT exp parsing.
extensibility/tokenprovider/server/main.go Wires temporal.WithTokenProvider(...) into a sample server.
extensibility/tokenprovider/server/main_test.go Boots the sample server and validates it becomes reachable with TokenProvider required.
extensibility/tokenprovider/server/testdata/config.yaml Minimal server config for tests, including remoteClusterAuth+TLS stub.
extensibility/go.mod Pins Temporal dependencies (incl. TokenProvider commit) and updates module requirements.
extensibility/go.sum Updates dependency checksums to match the new module graph.
extensibility/authorizer/myClaimMapper.go Switches TLS-based claim extraction to use TLSSubject when present (mTLS).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extensibility/tokenprovider/server/main.go
Comment thread extensibility/go.mod
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package tokenprovider

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the file to fileTokenProvider?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants