Skip to content
Snippets Groups Projects
Commit 8603d016 authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

cleanup grant types

parent 6e066aa3
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ require (
github.com/jinzhu/copier v0.3.2
github.com/jmoiron/sqlx v1.3.4
github.com/lestrrat-go/jwx v1.2.6
github.com/oidc-mytoken/api v0.0.0-20210730065550-117f733ae8a1
github.com/oidc-mytoken/api v0.3.1-0.20210921092134-2599cdd1db99
github.com/oidc-mytoken/lib v0.2.1-0.20210730094903-f59c9a8f84e0
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.0
......
......@@ -415,6 +415,8 @@ github.com/nishanths/exhaustive v0.0.0-20200525081945-8e46705b6132 h1:NjznefjSrr
github.com/nishanths/exhaustive v0.0.0-20200525081945-8e46705b6132/go.mod h1:wBEpHwM2OdmeNpdCvRPUlkEbBuaFmcK4Wv8Q7FuGW3c=
github.com/oidc-mytoken/api v0.0.0-20210730065550-117f733ae8a1 h1:i1LIDAuTm4SR65iPjVq+elXHSKNju3Yt61+jreULTuE=
github.com/oidc-mytoken/api v0.0.0-20210730065550-117f733ae8a1/go.mod h1:S8t1XA42EFAgc3vUfis0g1LPGA4TXH0nfDynvgo6cwk=
github.com/oidc-mytoken/api v0.3.1-0.20210921092134-2599cdd1db99 h1:0b66hU44d5wwcOpQhnilvIP0prVaQnZeaMLVCOYfAjQ=
github.com/oidc-mytoken/api v0.3.1-0.20210921092134-2599cdd1db99/go.mod h1:S8t1XA42EFAgc3vUfis0g1LPGA4TXH0nfDynvgo6cwk=
github.com/oidc-mytoken/lib v0.2.1-0.20210730094903-f59c9a8f84e0 h1:eo1lEHaU6vkQZnAQyy7dA7JIoXpUOS/G4csV1LPIi80=
github.com/oidc-mytoken/lib v0.2.1-0.20210730094903-f59c9a8f84e0/go.mod h1:2ITx3/ZTRyrR6GGIG3BfNdscxERXsD0Up8G3yZZDJng=
github.com/oidc-mytoken/server v0.2.0/go.mod h1:6uFm+Za9NMK3gq4OOIeX3gs3T6leluVIWsGiM1zlQbA=
......
......@@ -7,7 +7,7 @@ import (
"github.com/coreos/go-oidc/v3/oidc"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
yaml "gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"
model2 "github.com/oidc-mytoken/server/internal/model"
"github.com/oidc-mytoken/server/internal/utils/errorfmt"
......@@ -76,9 +76,7 @@ var defaultConfig = Config{
PollingCodeExpiresAfter: 300,
PollingInterval: 5,
},
TokenRotation: onlyEnable{true},
AccessTokenGrant: onlyEnable{true},
SignedJWTGrant: onlyEnable{true},
TokenRotation: onlyEnable{true},
TokenInfo: tokeninfoConfig{
Introspect: onlyEnable{true},
History: onlyEnable{true},
......@@ -120,8 +118,6 @@ type featuresConf struct {
TransferCodes onlyEnable `yaml:"transfer_codes"`
Polling pollingConf `yaml:"polling_codes"`
TokenRotation onlyEnable `yaml:"token_rotation"`
AccessTokenGrant onlyEnable `yaml:"access_token_grant"`
SignedJWTGrant onlyEnable `yaml:"signed_jwt_grant"`
TokenInfo tokeninfoConfig `yaml:"tokeninfo"`
WebInterface onlyEnable `yaml:"web_interface"`
DisabledRestrictionKeys model2.RestrictionKeys `yaml:"unsupported_restrictions"`
......
......@@ -41,8 +41,6 @@ func Init() {
addShortTokens(mytokenConfig)
addTransferCodes(mytokenConfig)
addPollingCodes(mytokenConfig)
addAccessTokenGrant(mytokenConfig)
addSignedJWTGrant(mytokenConfig)
addTokenInfo(mytokenConfig)
}
......@@ -95,16 +93,6 @@ func addPollingCodes(mytokenConfig *pkg.MytokenConfiguration) {
pkgModel.GrantTypePollingCode.AddToSliceIfNotFound(&mytokenConfig.MytokenEndpointGrantTypesSupported)
}
}
func addAccessTokenGrant(mytokenConfig *pkg.MytokenConfiguration) {
if config.Get().Features.AccessTokenGrant.Enabled {
pkgModel.GrantTypeAccessToken.AddToSliceIfNotFound(&mytokenConfig.MytokenEndpointGrantTypesSupported)
}
}
func addSignedJWTGrant(mytokenConfig *pkg.MytokenConfiguration) {
if config.Get().Features.SignedJWTGrant.Enabled {
pkgModel.GrantTypePrivateKeyJWT.AddToSliceIfNotFound(&mytokenConfig.MytokenEndpointGrantTypesSupported)
}
}
func addTokenInfo(mytokenConfig *pkg.MytokenConfiguration) {
if !config.Get().Features.TokenInfo.Enabled {
mytokenConfig.TokeninfoEndpoint = ""
......
......@@ -34,14 +34,6 @@ func HandleMytokenEndpoint(ctx *fiber.Ctx) error {
if config.Get().Features.Polling.Enabled {
return polling.HandlePollingCode(ctx)
}
case model.GrantTypeAccessToken:
if config.Get().Features.AccessTokenGrant.Enabled {
return serverModel.ResponseNYI.Send(ctx)
}
case model.GrantTypePrivateKeyJWT:
if config.Get().Features.SignedJWTGrant.Enabled {
return serverModel.ResponseNYI.Send(ctx)
}
case model.GrantTypeTransferCode:
if config.Get().Features.TransferCodes.Enabled {
return mytoken.HandleMytokenFromTransferCode(ctx).Send(ctx)
......
......@@ -5,7 +5,7 @@ import (
"github.com/oidc-mytoken/api/v0"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"
)
// GrantType is an enum like type for grant types
......@@ -19,8 +19,6 @@ const ( // assert that these are in the same order as api.AllGrantTypes
GrantTypeMytoken GrantType = iota
GrantTypeOIDCFlow
GrantTypePollingCode
GrantTypeAccessToken
GrantTypePrivateKeyJWT
GrantTypeTransferCode
maxGrantType
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment