feat: service account token exchange

This commit is contained in:
adlerhurst 2020-09-02 17:52:22 +02:00
parent c828290ef1
commit 7a109a763d
7 changed files with 71 additions and 10 deletions

View file

@ -3,6 +3,7 @@ package oidc
import (
"errors"
"strings"
"time"
"golang.org/x/text/language"
)
@ -24,7 +25,8 @@ const (
PromptConsent Prompt = "consent"
PromptSelectAccount Prompt = "select_account"
GrantTypeCode GrantType = "authorization_code"
GrantTypeCode GrantType = "authorization_code"
GrantTypeBearer GrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer"
BearerToken = "Bearer"
)
@ -100,6 +102,13 @@ type AccessTokenResponse struct {
IDToken string `json:"id_token,omitempty" schema:"id_token,omitempty"`
}
type JWTTokenRequest struct {
Scopes Scopes `schema:"scope"`
Audience []string `schema:"aud"`
IssuedAt time.Time `schema:"iat"`
ExpiresAt time.Time `schema:"exp"`
}
type TokenExchangeRequest struct {
subjectToken string `schema:"subject_token"`
subjectTokenType string `schema:"subject_token_type"`