openapi

package
v0.0.0-...-e9052da Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 18 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

View Source
const DEEPLINK = "DEEPLINK"
View Source
const DEFAULT_REQUEST_MODE = verifier.REQUEST_MODE_BY_REFERENCE
View Source
const FRONTEND_V1 = "FRONTEND_V1"
View Source
const FRONTEND_V2 = "FRONTEND_V2"

Variables

View Source
var ErrorMessagNoGrantType = ErrorMessage{"no_grant_type_provided", "Token requests require a grant_type."}
View Source
var ErrorMessageFailedSameDevice = ErrorMessage{"failed_same_device", "Was not able to start a same-device flow."}
View Source
var ErrorMessageInvalidAudience = ErrorMessage{"invalid_audience", "Audience of the request object was invalid."}
View Source
var ErrorMessageInvalidClientAssertion = ErrorMessage{"invalid_client_assertion", "Provided client assertion is invalid."}
View Source
var ErrorMessageInvalidRefreshToken = ErrorMessage{"invalid_refresh_token", "The provided refresh token is invalid or expired."}
View Source
var ErrorMessageInvalidRequestedTokenType = ErrorMessage{"invalid_requested_token_type", "Token exchange is only supported for requesting tokens of type urn:ietf:params:oauth:token-type:access_token."}
View Source
var ErrorMessageInvalidResponseType = ErrorMessage{"invalid_response_type", "Authentication requires the response_type to be `code`."}
View Source
var ErrorMessageInvalidSdJwt = ErrorMessage{"invalid_sdjwt", "SdJwt does not contain all required fields."}
View Source
var ErrorMessageInvalidSubjectTokenType = ErrorMessage{"invalid_subject_token_type", "Token exchange is only supported for token type urn:eu:oidf:vp_token."}
View Source
var ErrorMessageInvalidTokenRequest = ErrorMessage{"invalid_token_request", "Token request has no redirect_uri and no valid client assertion."}
View Source
var ErrorMessageNoCallback = ErrorMessage{"NoCallbackProvided", "A callback address has to be provided as query-parameter."}
View Source
var ErrorMessageNoClientId = ErrorMessage{"no_client_id_provided", "Authentication requires a client-id provided as a parameter."}
View Source
var ErrorMessageNoCode = ErrorMessage{"no_code_provided", "Token requests require a code."}
View Source
var ErrorMessageNoNonce = ErrorMessage{"no_nonce_provided", "Authentication requires a nonce provided as a query parameter."}
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 ErrorMessageNoRefreshToken = ErrorMessage{"no_refresh_token_provided", "Refresh token requests require a refresh_token."}
View Source
var ErrorMessageNoResource = ErrorMessage{"no_resource_provided", "When using token-exchange, resource is required to provide the client_id."}
View Source
var ErrorMessageNoScope = ErrorMessage{"no_scope_provided", "Authentication requires a scope provided as a parameter."}
View Source
var ErrorMessageNoState = ErrorMessage{"no_state_provided", "Authentication requires a state provided as query parameter."}
View Source
var ErrorMessageNoSuchSession = ErrorMessage{"no_session", "Session with the requested id is not available."}
View Source
var ErrorMessageNoToken = ErrorMessage{"no_token_provided", "Authentication requires a token provided as a form parameter."}
View Source
var ErrorMessageNoWebsocketConnection = ErrorMessage{"invalid_connection", "No Websocket connection available for the authenticated session."}
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 ErrorMessageUnresolvableRequestObject = ErrorMessage{"unresolvable_request_object", "Was not able to get the request object from the client."}
View Source
var ErrorMessageUnsupportedAssertionType = ErrorMessage{"unsupported_assertion_type", "Assertion type is not supported."}
View Source
var ErrorMessageUnsupportedGrantType = ErrorMessage{"unsupported_grant_type", "Provided grant_type is not supported by the implementation."}

Functions

func AuthorizationEndpoint

func AuthorizationEndpoint(c *gin.Context)

func GetRequestByReference

func GetRequestByReference(c *gin.Context)

GetRequestByReference - Get the request object by reference

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 VerifierLoginQr

func VerifierLoginQr(c *gin.Context)

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

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

func WsHandler

func WsHandler(c *gin.Context)

Types

type BackendInfo

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

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

type ClientAssertion

type ClientAssertion struct {
	Iss string   `json:"iss"`
	Aud []string `json:"aud"`
	Sub string   `json:"sub"`
	Exp int      `json:"exp"`
	Iat int      `json:"iat"`
}

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"`
	IssuedTokenType string `json:"issued_token_type,omitempty"`

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

	AccessToken string `json:"access_token,omitempty"`

	// Refresh token to obtain new access tokens. Only present when refresh tokens are enabled.
	RefreshToken string `json:"refresh_token,omitempty"`

	// Lifetime in seconds of the refresh token. Only present when a refresh token is issued.
	RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in,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