openapi

package
v0.0.0-...-580780f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

README

Go API Server for openapi

Backend component to verify credentials

Overview

This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 0.0.1
  • Build date: 2023-03-15T12:51:54.096463Z[Etc/UTC]
Running the server

To run the server, follow these simple steps:

go run main.go

To run the server in a docker container

docker build --network=host -t openapi .

Once the image is built, just run

docker run --rm -it openapi
Known Issue

Endpoints sharing a common path may result in issues. For example, /v2/pet/findByTags and /v2/pet/:petId will result in an issue with the Gin framework. For more information about this known limitation, please refer to gin-gonic/gin#388 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Create

docker run --rm
-v ${PWD}:/local openapitools/openapi-generator-cli generate
-i /local/api/api.yaml
-g go-gin-server
-o /local/out/go

Documentation

Overview

* Authorisation API * * The subset of the [Authentication API as defined by EBSI](https://api-pilot.ebsi.eu/docs/apis/authorisation/latest#/). * * API version: v4 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* Authorisation API * * The subset of the [Authentication API as defined by EBSI](https://api-pilot.ebsi.eu/docs/apis/authorisation/latest#/). * * API version: v4 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

Index

Constants

This section is empty.

Variables

View Source
var ErrorMessagNoGrantType = ErrorMessage{"no_grant_type_provided", "Token requests require a grant_type."}
View Source
var ErrorMessageNoCallback = ErrorMessage{"NoCallbackProvided", "A callback address has to be provided as query-parameter."}
View Source
var ErrorMessageNoCode = ErrorMessage{"no_code_provided", "Token requests require a code."}
View Source
var ErrorMessageNoPresentationSubmission = ErrorMessage{"no_presentation_submission_provided", "Authentication requires a presentation submission provided as a form parameter."}
View Source
var ErrorMessageNoRedircetUri = ErrorMessage{"no_redirect_uri_provided", "Token requests require a redirect_uri."}
View Source
var ErrorMessageNoScope = ErrorMessage{"no_scope_provided", "Authentication requires a scope provided as a form parameter."}
View Source
var ErrorMessageNoState = ErrorMessage{"no_state_provided", "Authentication requires a state provided as query parameter."}
View Source
var ErrorMessageNoToken = ErrorMessage{"no_token_provided", "Authentication requires a token provided as a form parameter."}
View Source
var ErrorMessageUnableToDecodeCredential = ErrorMessage{"invalid_token", "Could not read the credential(s) inside the token."}
View Source
var ErrorMessageUnableToDecodeHolder = ErrorMessage{"invalid_token", "Could not read the holder inside the token."}
View Source
var ErrorMessageUnableToDecodeToken = ErrorMessage{"invalid_token", "Token could not be decoded."}
View Source
var ErrorMessageUnsupportedGrantType = ErrorMessage{"unsupported_grant_type", "Provided grant_type is not supported by the implementation."}

Functions

func GetToken

func GetToken(c *gin.Context)

GetToken - Token endpoint to exchange the authorization code with the actual JWT.

func GetTokenForService

func GetTokenForService(c *gin.Context)

GetToken - Token endpoint to exchange the authorization code with the actual JWT.

func GetVerifierAPIAuthenticationResponse

func GetVerifierAPIAuthenticationResponse(c *gin.Context)

GetVerifierAPIAuthenticationResponse - Stores the credential for the given session

func Index

func Index(c *gin.Context)

Index is the index handler.

func NewRouter

func NewRouter() *gin.Engine

NewRouter returns a new router.

func StartSIOPSameDevice

func StartSIOPSameDevice(c *gin.Context)

StartSIOPSameDevice - Starts the siop flow for credentials hold by the same device

func VerifierAPIAuthenticationResponse

func VerifierAPIAuthenticationResponse(c *gin.Context)

VerifierAPIAuthenticationResponse - Stores the credential for the given session

func VerifierAPIJWKS

func VerifierAPIJWKS(c *gin.Context)

VerifierAPIJWKS - Provides the public keys for the given verifier, to be used for verifing the JWTs

func VerifierAPIOpenIDConfiguration

func VerifierAPIOpenIDConfiguration(c *gin.Context)

VerifierAPIOpenID

func VerifierAPIStartSIOP

func VerifierAPIStartSIOP(c *gin.Context)

VerifierAPIStartSIOP - Initiates the siop flow and returns the 'openid://...' connection string

func VerifierPageDisplayQRSIOP

func VerifierPageDisplayQRSIOP(c *gin.Context)

VerifierPageDisplayQRSIOP - Presents a qr as starting point for the auth process

func VerifierPageLoginExpired

func VerifierPageLoginExpired(c *gin.Context)

VerifierPageLoginExpired - Presents a page when the login session is expired

Types

type BackendInfo

type BackendInfo struct {
	IssuerDid Did `json:"issuerDid,omitempty"`

	VerifierDid Did `json:"verifierDid,omitempty"`
}

type CredentialSchema

type CredentialSchema struct {
	Id string `json:"id,omitempty"`

	Type string `json:"type,omitempty"`
}

type Did

type Did struct {
	Id string `json:"id,omitempty"`
}

type ErrorMessage

type ErrorMessage struct {
	Summary string `json:"summary,omitempty"`

	Details string `json:"details,omitempty"`
}

type Jwk

type Jwk struct {
	Kid string `json:"kid,omitempty"`

	Kty string `json:"kty,omitempty"`

	Use string `json:"use,omitempty"`

	Alg string `json:"alg,omitempty"`

	Crv string `json:"crv,omitempty"`

	X string `json:"x,omitempty"`

	Y string `json:"y,omitempty"`

	N string `json:"n,omitempty"`

	E string `json:"e,omitempty"`

	D string `json:"d,omitempty"`
}

type JwkSet

type JwkSet struct {
	Keys []Jwk `json:"keys,omitempty"`
}

type PacketDeliverySubject

type PacketDeliverySubject struct {
	Id string `json:"id,omitempty"`

	FamilyName string `json:"familyName,omitempty"`

	FirstName string `json:"firstName,omitempty"`

	Roles []SubjectRole `json:"roles,omitempty"`

	Email string `json:"email,omitempty"`
}

type ProblemDetails

type ProblemDetails struct {
	// An absolute URI that identifies the problem type. When dereferenced, it SHOULD provide human-readable documentation for the problem type.
	Type_ string `json:"type,omitempty"`
	// A short summary of the problem type.
	Title string `json:"title,omitempty"`
	// The HTTP status code generated by the origin server for this occurrence of the problem.
	Status float64 `json:"status,omitempty"`
	// A human readable explanation specific to this occurrence of the problem.
	Detail string `json:"detail,omitempty"`
	// An absolute URI that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
	Instance string `json:"instance,omitempty"`
}

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

type SubjectRole

type SubjectRole struct {
	Names []string `json:"names,omitempty"`

	Target string `json:"target,omitempty"`
}

type TokenRequestBody

type TokenRequestBody struct {
	// MUST be set to \"vp_token\"
	GrantType string `json:"grant_type"`
	// Signed Verifiable Presentation. See also the VP Token schema definition.
	VpToken string `json:"vp_token"`
	// Descriptor for the vp_token, linked by presentation_definition. See also the Presentation Definition schema.
	PresentationSubmission string `json:"presentation_submission"`
	// OIDC scope
	Scope string `json:"scope"`
}

type TokenResponse

type TokenResponse struct {
	TokenType string `json:"token_type,omitempty"`

	// The lifetime in seconds of the access token
	ExpiresIn float32 `json:"expires_in,omitempty"`

	AccessToken string `json:"access_token,omitempty"`

	// The scope of the access token
	Scope string `json:"scope,omitempty"`
	// ID Token value associated with the authenticated session. Presents client's identity. ID Token is issued in a JWS format. See also the \"ID Token\" schema definition.
	IdToken string `json:"id_token,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL