Created
June 22, 2021 13:29
-
-
Save sedkis/b0a6ff04447e7b40afb86ed2a6f30696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/base64" | |
"net/http" | |
"github.com/TykTechnologies/tyk/ctx" | |
) | |
func SetSessionPublicKeyVerifier(rw http.ResponseWriter, r *http.Request) { | |
// Get the API Definition | |
requestedAPI := ctx.GetDefinition(r) | |
// Set the JWT Public Key that Tyk will validate the JWT against | |
requestedAPI.JWTSource = base64.StdEncoding.EncodeToString([]byte("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzyis1ZjfNB0bBgKFMSv\nvkTtwlvBsaJq7S5wA+kzeVOVpVWwkWdVha4s38XM/pa/yr47av7+z3VTmvDRyAHc\naT92whREFpLv9cj5lTeJSibyr/Mrm/YtjCZVWgaOYIhwrXwKLqPr/11inWsAkfIy\ntvHWTxZYEcXLgAXFuUuaS3uF9gEiNQwzGTU1v0FqkqTBr4B8nW3HCN47XUu0t8Y0\ne+lf4s4OxQawWD79J9/5d3Ry0vbV3Am1FtGJiJvOwRsIfVChDpYStTcHTCMqtvWb\nV6L11BWkpzGXSW4Hv43qa+GSYOD2QU68Mb59oSk2OB+BtOLpJofmbGEGgvmwyCI9\nMwIDAQAB\n-----END PUBLIC KEY-----")) | |
ctx.SetDefinition(r, requestedAPI) | |
} | |
// called once plugin is loaded, this is where we put all initialization work for plugin | |
// i.e. setting exported functions, setting up connection pool to storage and etc. | |
func init() { | |
logger.Info("Initialising Example Go Plugin") | |
} | |
func main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment