New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/ory/hydra/internal/httpclient-next

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ory/hydra/internal/httpclient-next

  • v0.0.0-20220813141611-b3abc58d5b97
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go API client for client

Documentation for all of Ory Hydra's APIs.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import client "github.com/ory/hydra-client-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), client.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
AdminApiAcceptConsentRequestPut /oauth2/auth/requests/consent/acceptAccept a Consent Request
AdminApiAcceptLoginRequestPut /oauth2/auth/requests/login/acceptAccept a Login Request
AdminApiAcceptLogoutRequestPut /oauth2/auth/requests/logout/acceptAccept a Logout Request
AdminApiCreateJsonWebKeySetPost /keys/{set}Generate a New JSON Web Key
AdminApiCreateOAuth2ClientPost /clientsCreate an OAuth 2.0 Client
AdminApiDeleteJsonWebKeyDelete /keys/{set}/{kid}Delete a JSON Web Key
AdminApiDeleteJsonWebKeySetDelete /keys/{set}Delete a JSON Web Key Set
AdminApiDeleteOAuth2ClientDelete /clients/{id}Deletes an OAuth 2.0 Client
AdminApiDeleteOAuth2TokenDelete /oauth2/tokensDelete OAuth2 Access Tokens from a Client
AdminApiDeleteTrustedJwtGrantIssuerDelete /trust/grants/jwt-bearer/issuers/{id}Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer
AdminApiFlushInactiveOAuth2TokensPost /oauth2/flushFlush Expired OAuth2 Access Tokens
AdminApiGetConsentRequestGet /oauth2/auth/requests/consentGet Consent Request Information
AdminApiGetJsonWebKeyGet /keys/{set}/{kid}Fetch a JSON Web Key
AdminApiGetJsonWebKeySetGet /keys/{set}Retrieve a JSON Web Key Set
AdminApiGetLoginRequestGet /oauth2/auth/requests/loginGet a Login Request
AdminApiGetLogoutRequestGet /oauth2/auth/requests/logoutGet a Logout Request
AdminApiGetOAuth2ClientGet /clients/{id}Get an OAuth 2.0 Client
AdminApiGetTrustedJwtGrantIssuerGet /trust/grants/jwt-bearer/issuers/{id}Get a Trusted OAuth2 JWT Bearer Grant Type Issuer
AdminApiIntrospectOAuth2TokenPost /oauth2/introspectIntrospect OAuth2 Tokens
AdminApiListOAuth2ClientsGet /clientsList OAuth 2.0 Clients
AdminApiListSubjectConsentSessionsGet /oauth2/auth/sessions/consentLists All Consent Sessions of a Subject
AdminApiListTrustedJwtGrantIssuersGet /trust/grants/jwt-bearer/issuersList Trusted OAuth2 JWT Bearer Grant Type Issuers
AdminApiPatchOAuth2ClientPatch /clients/{id}Patch an OAuth 2.0 Client
AdminApiRejectConsentRequestPut /oauth2/auth/requests/consent/rejectReject a Consent Request
AdminApiRejectLoginRequestPut /oauth2/auth/requests/login/rejectReject a Login Request
AdminApiRejectLogoutRequestPut /oauth2/auth/requests/logout/rejectReject a Logout Request
AdminApiRevokeAuthenticationSessionDelete /oauth2/auth/sessions/loginInvalidates All Login Sessions of a Certain User Invalidates a Subject's Authentication Session
AdminApiRevokeConsentSessionsDelete /oauth2/auth/sessions/consentRevokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client
AdminApiTrustJwtGrantIssuerPost /trust/grants/jwt-bearer/issuersTrust an OAuth2 JWT Bearer Grant Type Issuer
AdminApiUpdateJsonWebKeyPut /keys/{set}/{kid}Update a JSON Web Key
AdminApiUpdateJsonWebKeySetPut /keys/{set}Update a JSON Web Key Set
AdminApiUpdateOAuth2ClientPut /clients/{id}Update an OAuth 2.0 Client
AdminApiUpdateOAuth2ClientLifespansPut /clients/{id}/lifespans
MetadataApiGetVersionGet /versionReturn Running Software Version.
MetadataApiIsAliveGet /health/aliveCheck HTTP Server Status
MetadataApiIsReadyGet /health/readyCheck HTTP Server and Database Status
PublicApiDisconnectUserGet /oauth2/sessions/logoutOpenID Connect Front-Backchannel Enabled Logout
PublicApiDiscoverOpenIDConfigurationGet /.well-known/openid-configurationOpenID Connect Discovery
PublicApiDynamicClientRegistrationCreateOAuth2ClientPost /oauth2/registerRegister an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
PublicApiDynamicClientRegistrationDeleteOAuth2ClientDelete /oauth2/register/{id}Deletes an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
PublicApiDynamicClientRegistrationGetOAuth2ClientGet /oauth2/register/{id}Get an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
PublicApiDynamicClientRegistrationUpdateOAuth2ClientPut /oauth2/register/{id}Update an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol
PublicApiOauth2TokenPost /oauth2/tokenThe OAuth 2.0 Token Endpoint
PublicApiOauthAuthGet /oauth2/authThe OAuth 2.0 Authorize Endpoint
PublicApiRevokeOAuth2TokenPost /oauth2/revokeRevoke OAuth2 Tokens
PublicApiUserinfoGet /userinfoOpenID Connect Userinfo
PublicApiWellKnownGet /.well-known/jwks.jsonJSON Web Keys Discovery

Documentation For Models

Documentation For Authorization

basic

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://hydra.demo.ory.sh/oauth2/auth
  • Scopes:
  • offline: A scope required when requesting refresh tokens (alias for offline_access)
  • offline_access: A scope required when requesting refresh tokens
  • openid: Request an OpenID Connect ID Token

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

hi@ory.sh

FAQs

Package last updated on 13 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc