Commit e314f02f authored by Simon Schürg's avatar Simon Schürg 🚀
Browse files

feat(certs): Add the certs command to fetch ans print oidc issuer public keys

parent 60da53b3
package cmd
import (
"fmt"
"git.schuerg.net/simon/actl/internal"
"github.com/spf13/cobra"
)
var certsCmd = &cobra.Command{
Use: "certs [issuer]",
Short: "Fetch and print OIDC issuer public keys as JWKS and PEM.",
Long: `Fetches the publicly available certitifaces from an OpenID Connect Issuer.
Prints it as JWKS (JSON Web Key Set), as provided by OIDC, but also convert it to
the widely used PEM (Privacy Enhanced Mail) for usage in conjunction with other software
or libraries.`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
issuer := args[0]
jwks := internal.FetchJWKSet(issuer)
for _, jwk := range jwks.Keys {
internal.PrintStructAsJSON(jwk)
pem := internal.JWKToPEM(jwk)
fmt.Println(pem)
fmt.Println("")
}
},
}
func init() {
rootCmd.AddCommand(certsCmd)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment