Starting work on oAuth Flows.

This commit is contained in:
Dave Shanley
2022-08-06 18:40:23 -04:00
parent 95e3cd9604
commit e8bb52bf3d
4 changed files with 61 additions and 28 deletions

View File

@@ -1,24 +1,40 @@
package v3
import (
"github.com/pb33f/libopenapi/datamodel/low"
"gopkg.in/yaml.v3"
"github.com/pb33f/libopenapi/datamodel/low"
"gopkg.in/yaml.v3"
)
type OAuthFlows struct {
Node *yaml.Node
Implicit OAuthFlow
Password OAuthFlow
ClientCredentials OAuthFlow
AuthorizationCode OAuthFlow
Extensions map[string]low.ObjectReference
Implicit low.NodeReference[*OAuthFlow]
Password low.NodeReference[*OAuthFlow]
ClientCredentials low.NodeReference[*OAuthFlow]
AuthorizationCode low.NodeReference[*OAuthFlow]
Extensions map[low.KeyReference[string]]low.ValueReference[any]
}
func (o *OAuthFlows) Build(root *yaml.Node) error {
extensionMap, err := ExtractExtensions(root)
if err != nil {
return err
}
o.Extensions = extensionMap
return nil
}
type OAuthFlow struct {
Node *yaml.Node
AuthorizationUrl low.NodeReference[string]
TokenURL low.NodeReference[string]
RefreshURL low.NodeReference[string]
Scopes map[string]string
Extensions map[string]low.ObjectReference
AuthorizationUrl low.NodeReference[string]
TokenURL low.NodeReference[string]
RefreshURL low.NodeReference[string]
Scopes map[low.KeyReference[string]]low.ValueReference[string]
Extensions map[low.KeyReference[string]]low.ValueReference[any]
}
func (o *OAuthFlow) Build(root *yaml.Node) error {
extensionMap, err := ExtractExtensions(root)
if err != nil {
return err
}
o.Extensions = extensionMap
return nil
}