oidcpismo

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT

README

license Go Report Card Go Reference

oidcpismo

Package oidcpismo provides helpers for generating JWT tokens and requesting access tokens from the Pismo OIDC endpoint.

See:

https://developers.pismo.io/pismo-docs/docs/authentication-with-openid#generate-your-jwt

https://developers.pismo.io/pismo-docs/reference/post-passport-v1-oauth2-token-1

Synopsis

privKeyPem, errRead := os.ReadFile("key-priv.pem")

privKey, errParse := jwt.ParseRSAPrivateKeyFromPEM(privKeyPem)

options := oidcpismo.Options{
    TokenURL: "https://sandbox.pismolabs.io/passport/v1/oauth2/token",
    Client:   http.DefaultClient,
    PrivKey:  privKey,

    TenantID: "tenant-id",
    UID:      "account-id",
    Pismo: map[string]any{
        "group": "pismo-v1:some-samplegroup:rw",
    },
    CustomClaims: map[string]any{
        "custom1":     "someValue",
        "userexample": "user@user.com",
    },

    Issuer:   "issuer",
    Subject:  "subject",
    Audience: "audience",
    Expire:   time.Hour,
}

resp, errResp := oidcpismo.GetAccessToken(context.Background(), options)

Example

See the examples/oidcpismo-client/main.go.

Generate keys

# Generate a private key:

openssl genpkey -out key-priv.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048

# Generate a public key based on the private key:

openssl rsa -in key-priv.pem -out key-pub.pem -pubout -outform PEM

Directories

Path Synopsis
examples
oidcpismo-client command
Package main implements the tool.
Package main implements the tool.
oidcpismo-server command
Package main implements the tool.
Package main implements the tool.
Package oidcpismo provides a library for implementing OIDC client for Pismo.
Package oidcpismo provides a library for implementing OIDC client for Pismo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL