osbuild-mock-openid-provider: use offline token as org id
This is quite a hack. Basically, the mock provider copies the offline token into rh-org-id JWT claim. This allows us to test multi-tenancy. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
c1dc58eba4
commit
33a310e4e1
1 changed files with 7 additions and 0 deletions
|
|
@ -82,13 +82,20 @@ func main() {
|
|||
Type string `json:"typ"`
|
||||
ExpiresAt int64 `json:"exp"`
|
||||
IssuedAt int64 `json:"iat"`
|
||||
RHOrgID string `json:"rh-org-id"`
|
||||
jwt.Claims
|
||||
}
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
cc := customClaims{
|
||||
Type: "Bearer",
|
||||
ExpiresAt: 0,
|
||||
IssuedAt: time.Now().Unix(),
|
||||
// Use refresh_token as rh-org-id
|
||||
RHOrgID: r.Form.Get("refresh_token"),
|
||||
}
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodRS256, cc)
|
||||
token.Header["kid"] = "key-id"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue