Documentation ¶
Index ¶
- Variables
- func LoadCertificate(path string) ([]byte, error)
- type ClaimsCarrier
- func (c ClaimsCarrier) AssertExpired() bool
- func (c ClaimsCarrier) AssertNotYetValid() bool
- func (c ClaimsCarrier) GetAudience() string
- func (c ClaimsCarrier) GetExpiresAt() time.Time
- func (c ClaimsCarrier) GetID() string
- func (c ClaimsCarrier) GetIssuedAt() time.Time
- func (c ClaimsCarrier) GetIssuer() string
- func (c ClaimsCarrier) GetNotBefore() time.Time
- func (c ClaimsCarrier) GetSubject() string
- func (c ClaimsCarrier) String() string
- type JWT
- type Map
Constants ¶
This section is empty.
Variables ¶
View Source
var TestCertificates = [][]string{
{"../example/cert/rs256-private.pem",
`-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA4f5wg5l2hKsTeNem/V41fGnJm6gOdrj8ym3rFkEU/wT8RDtn
SgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7mCpz9Er5qLaMXJwZxzHzAahlfA0i
cqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBpHssPnpYGIn20ZZuNlX2BrClciHhC
PUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2XrHhR+1DcKJzQBSTAGnpYVaqpsAR
ap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3bODIRe1AuTyHceAbewn8b462yEWKA
Rdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy7wIDAQABAoIBAQCwia1k7+2oZ2d3
n6agCAbqIE1QXfCmh41ZqJHbOY3oRQG3X1wpcGH4Gk+O+zDVTV2JszdcOt7E5dAy
MaomETAhRxB7hlIOnEN7WKm+dGNrKRvV0wDU5ReFMRHg31/Lnu8c+5BvGjZX+ky9
POIhFFYJqwCRlopGSUIxmVj5rSgtzk3iWOQXr+ah1bjEXvlxDOWkHN6YfpV5ThdE
KdBIPGEVqa63r9n2h+qazKrtiRqJqGnOrHzOECYbRFYhexsNFz7YT02xdfSHn7gM
IvabDDP/Qp0PjE1jdouiMaFHYnLBbgvlnZW9yuVf/rpXTUq/njxIXMmvmEyyvSDn
FcFikB8pAoGBAPF77hK4m3/rdGT7X8a/gwvZ2R121aBcdPwEaUhvj/36dx596zvY
mEOjrWfZhF083/nYWE2kVquj2wjs+otCLfifEEgXcVPTnEOPO9Zg3uNSL0nNQghj
FuD3iGLTUBCtM66oTe0jLSslHe8gLGEQqyMzHOzYxNqibxcOZIe8Qt0NAoGBAO+U
I5+XWjWEgDmvyC3TrOSf/KCGjtu0TSv30ipv27bDLMrpvPmD/5lpptTFwcxvVhCs
2b+chCjlghFSWFbBULBrfci2FtliClOVMYrlNBdUSJhf3aYSG2Doe6Bgt1n2CpNn
/iu37Y3NfemZBJA7hNl4dYe+f+uzM87cdQ214+jrAoGAXA0XxX8ll2+ToOLJsaNT
OvNB9h9Uc5qK5X5w+7G7O998BN2PC/MWp8H+2fVqpXgNENpNXttkRm1hk1dych86
EunfdPuqsX+as44oCyJGFHVBnWpm33eWQw9YqANRI+pCJzP08I5WK3osnPiwshd+
hR54yjgfYhBFNI7B95PmEQkCgYBzFSz7h1+s34Ycr8SvxsOBWxymG5zaCsUbPsL0
4aCgLScCHb9J+E86aVbbVFdglYa5Id7DPTL61ixhl7WZjujspeXZGSbmq0Kcnckb
mDgqkLECiOJW2NHP/j0McAkDLL4tysF8TLDO8gvuvzNC+WQ6drO2ThrypLVZQ+ry
eBIPmwKBgEZxhqa0gVvHQG/7Od69KWj4eJP28kq13RhKay8JOoN0vPmspXJo1HY3
CKuHRG+AP579dncdUnOMvfXOtkdM4vk0+hWASBQzM9xzVcztCa+koAugjVaLS9A+
9uQoqEeVNTckxx0S2bYevRy7hGQmUJTyQm3j1zEUR5jpdbL83Fbq
-----END RSA PRIVATE KEY-----
`},
{"../example/cert/rs256-public.pem",
`-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4f5wg5l2hKsTeNem/V41
fGnJm6gOdrj8ym3rFkEU/wT8RDtnSgFEZOQpHEgQ7JL38xUfU0Y3g6aYw9QT0hJ7
mCpz9Er5qLaMXJwZxzHzAahlfA0icqabvJOMvQtzD6uQv6wPEyZtDTWiQi9AXwBp
HssPnpYGIn20ZZuNlX2BrClciHhCPUIIZOQn/MmqTD31jSyjoQoV7MhhMTATKJx2
XrHhR+1DcKJzQBSTAGnpYVaqpsARap+nwRipr3nUTuxyGohBTSmjJ2usSeQXHI3b
ODIRe1AuTyHceAbewn8b462yEWKARdpd9AjQW5SIVPfdsz5B6GlYQ5LdYKtznTuy
7wIDAQAB
-----END PUBLIC KEY-----
`,
},
}
Functions ¶
func LoadCertificate ¶
Helper func: Read certificate from specified file
Types ¶
type ClaimsCarrier ¶
type ClaimsCarrier map[string]interface{}
func NewClaimsCarrier ¶
func NewClaimsCarrier(id, issuer, subject, audience string, expiresAt, notBefore, issuedAt time.Time) ClaimsCarrier
TODO NewClaimsCarrier should require a request object instead
func (ClaimsCarrier) AssertExpired ¶
func (c ClaimsCarrier) AssertExpired() bool
func (ClaimsCarrier) AssertNotYetValid ¶
func (c ClaimsCarrier) AssertNotYetValid() bool
func (ClaimsCarrier) GetAudience ¶
func (c ClaimsCarrier) GetAudience() string
func (ClaimsCarrier) GetExpiresAt ¶
func (c ClaimsCarrier) GetExpiresAt() time.Time
func (ClaimsCarrier) GetID ¶
func (c ClaimsCarrier) GetID() string
func (ClaimsCarrier) GetIssuedAt ¶
func (c ClaimsCarrier) GetIssuedAt() time.Time
func (ClaimsCarrier) GetIssuer ¶
func (c ClaimsCarrier) GetIssuer() string
func (ClaimsCarrier) GetNotBefore ¶
func (c ClaimsCarrier) GetNotBefore() time.Time
func (ClaimsCarrier) GetSubject ¶
func (c ClaimsCarrier) GetSubject() string
func (ClaimsCarrier) String ¶
func (c ClaimsCarrier) String() string
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
func (*JWT) GenerateAccessToken ¶
func (*JWT) SignToken ¶
func (j *JWT) SignToken(claims map[string]interface{}, header map[string]interface{}) (string, error)
Create, sign, and return a token.
func (*JWT) VerifyToken ¶
Verify a token and output the claims.
Click to show internal directories.
Click to hide internal directories.