A Go library for Ory Hydra Admin API
Find a file
2022-03-11 01:48:56 +01:00
api.go fix endpoint pasing issues 2022-03-11 01:48:56 +01:00
clients.go add consent, login and logout 2022-03-10 19:43:23 +01:00
clients_test.go add consent, login and logout 2022-03-10 19:43:23 +01:00
consent.go fix accept consent response + better redirect struct 2022-03-10 20:46:38 +01:00
go.mod init 2022-03-10 17:33:46 +01:00
go.sum init 2022-03-10 17:33:46 +01:00
infos.go add infos 2022-03-10 20:02:13 +01:00
init.go fix loop issue when error 2022-03-10 22:09:47 +01:00
login.go fix accept consent response + better redirect struct 2022-03-10 20:46:38 +01:00
logout.go fix accept consent response + better redirect struct 2022-03-10 20:46:38 +01:00
models.go fix accept consent response + better redirect struct 2022-03-10 20:46:38 +01:00
README.md add consent, login and logout 2022-03-10 19:43:23 +01:00

CW-Hydra

Ory Hydra client for coldwire's purposes

go get codeberg.org/coldwire/cwhydra

Exemple

// Initialize API
api := cwhydra.New(cwhydra.Config{
  Url: "http://127.0.0.1:4445", // Admin Endpoint
  Http: http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
		Timeout: 0,
	},
})

log.Println("Creating a client named 'test'")
create, err := cwhydra.ClientManager(api).Create(cwhydra.OAuth2Client{
	ClientName: "test",
})
if err != nil {
	t.Error(err)
}

log.Println("> The client id is:", create.ClientId)

log.Println("Getting the created client")
g, err := cwhydra.ClientManager(api).Get(create.ClientId)
if err != nil {
	t.Error(err)
}

log.Println(">", "Name of the client:", g.ClientName)

log.Println("List all clients")
clients, err := cwhydra.ClientManager(api).List()
if err != nil {
	t.Error(err)
}

for i, v := range clients {
	log.Println(">", i, v.ClientId)
}

log.Println("Deleting client:", create.ClientId)
err = cwhydra.ClientManager(api).Delete(create.ClientId)
if err != nil {
	t.Error(err)
}