Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/ory/hydra/internal/httpclient-next
Documentation for all of Ory Hydra's APIs.
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.
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")
Default configuration comes with Servers
field that contains server objects as
defined in the OpenAPI specification.
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 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.
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",
},
})
All URIs are relative to http://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
AdminApi | AcceptConsentRequest | Put /oauth2/auth/requests/consent/accept | Accept a Consent Request |
AdminApi | AcceptLoginRequest | Put /oauth2/auth/requests/login/accept | Accept a Login Request |
AdminApi | AcceptLogoutRequest | Put /oauth2/auth/requests/logout/accept | Accept a Logout Request |
AdminApi | CreateJsonWebKeySet | Post /keys/{set} | Generate a New JSON Web Key |
AdminApi | CreateOAuth2Client | Post /clients | Create an OAuth 2.0 Client |
AdminApi | DeleteJsonWebKey | Delete /keys/{set}/{kid} | Delete a JSON Web Key |
AdminApi | DeleteJsonWebKeySet | Delete /keys/{set} | Delete a JSON Web Key Set |
AdminApi | DeleteOAuth2Client | Delete /clients/{id} | Deletes an OAuth 2.0 Client |
AdminApi | DeleteOAuth2Token | Delete /oauth2/tokens | Delete OAuth2 Access Tokens from a Client |
AdminApi | DeleteTrustedJwtGrantIssuer | Delete /trust/grants/jwt-bearer/issuers/{id} | Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer |
AdminApi | FlushInactiveOAuth2Tokens | Post /oauth2/flush | Flush Expired OAuth2 Access Tokens |
AdminApi | GetConsentRequest | Get /oauth2/auth/requests/consent | Get Consent Request Information |
AdminApi | GetJsonWebKey | Get /keys/{set}/{kid} | Fetch a JSON Web Key |
AdminApi | GetJsonWebKeySet | Get /keys/{set} | Retrieve a JSON Web Key Set |
AdminApi | GetLoginRequest | Get /oauth2/auth/requests/login | Get a Login Request |
AdminApi | GetLogoutRequest | Get /oauth2/auth/requests/logout | Get a Logout Request |
AdminApi | GetOAuth2Client | Get /clients/{id} | Get an OAuth 2.0 Client |
AdminApi | GetTrustedJwtGrantIssuer | Get /trust/grants/jwt-bearer/issuers/{id} | Get a Trusted OAuth2 JWT Bearer Grant Type Issuer |
AdminApi | IntrospectOAuth2Token | Post /oauth2/introspect | Introspect OAuth2 Tokens |
AdminApi | ListOAuth2Clients | Get /clients | List OAuth 2.0 Clients |
AdminApi | ListSubjectConsentSessions | Get /oauth2/auth/sessions/consent | Lists All Consent Sessions of a Subject |
AdminApi | ListTrustedJwtGrantIssuers | Get /trust/grants/jwt-bearer/issuers | List Trusted OAuth2 JWT Bearer Grant Type Issuers |
AdminApi | PatchOAuth2Client | Patch /clients/{id} | Patch an OAuth 2.0 Client |
AdminApi | RejectConsentRequest | Put /oauth2/auth/requests/consent/reject | Reject a Consent Request |
AdminApi | RejectLoginRequest | Put /oauth2/auth/requests/login/reject | Reject a Login Request |
AdminApi | RejectLogoutRequest | Put /oauth2/auth/requests/logout/reject | Reject a Logout Request |
AdminApi | RevokeAuthenticationSession | Delete /oauth2/auth/sessions/login | Invalidates All Login Sessions of a Certain User Invalidates a Subject's Authentication Session |
AdminApi | RevokeConsentSessions | Delete /oauth2/auth/sessions/consent | Revokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client |
AdminApi | TrustJwtGrantIssuer | Post /trust/grants/jwt-bearer/issuers | Trust an OAuth2 JWT Bearer Grant Type Issuer |
AdminApi | UpdateJsonWebKey | Put /keys/{set}/{kid} | Update a JSON Web Key |
AdminApi | UpdateJsonWebKeySet | Put /keys/{set} | Update a JSON Web Key Set |
AdminApi | UpdateOAuth2Client | Put /clients/{id} | Update an OAuth 2.0 Client |
AdminApi | UpdateOAuth2ClientLifespans | Put /clients/{id}/lifespans | |
MetadataApi | GetVersion | Get /version | Return Running Software Version. |
MetadataApi | IsAlive | Get /health/alive | Check HTTP Server Status |
MetadataApi | IsReady | Get /health/ready | Check HTTP Server and Database Status |
PublicApi | DisconnectUser | Get /oauth2/sessions/logout | OpenID Connect Front-Backchannel Enabled Logout |
PublicApi | DiscoverOpenIDConfiguration | Get /.well-known/openid-configuration | OpenID Connect Discovery |
PublicApi | DynamicClientRegistrationCreateOAuth2Client | Post /oauth2/register | Register an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol |
PublicApi | DynamicClientRegistrationDeleteOAuth2Client | Delete /oauth2/register/{id} | Deletes an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol |
PublicApi | DynamicClientRegistrationGetOAuth2Client | Get /oauth2/register/{id} | Get an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol |
PublicApi | DynamicClientRegistrationUpdateOAuth2Client | Put /oauth2/register/{id} | Update an OAuth 2.0 Client using the OpenID / OAuth2 Dynamic Client Registration Management Protocol |
PublicApi | Oauth2Token | Post /oauth2/token | The OAuth 2.0 Token Endpoint |
PublicApi | OauthAuth | Get /oauth2/auth | The OAuth 2.0 Authorize Endpoint |
PublicApi | RevokeOAuth2Token | Post /oauth2/revoke | Revoke OAuth2 Tokens |
PublicApi | Userinfo | Get /userinfo | OpenID Connect Userinfo |
PublicApi | WellKnown | Get /.well-known/jwks.json | JSON Web Keys Discovery |
Example
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
offline_access
)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)
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
FAQs
Unknown package
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.