Osin-example - Example of a identity provider powered by OAuth 2.0 in Golang

go mod init github.com/bartmika/osin-example

go get github.com/google/uuid go get github.com/rs/cors go get github.com/spf13/cobra go get github.com/go-redis/redis
go get github.com/dgrijalva/jwt-go go get golang.org/x/crypto/bcrypt go get github.com/lib/pq go get gopkg.in/guregu/null.v4 go get golang.org/x/oauth2 go get github.com/ShaleApps/osinredis go get github.com/openshift/osin

export OSIN_DB_HOST=localhost
export OSIN_DB_PORT=5432
export OSIN_DB_USER=golang
export OSIN_DB_PASSWORD=123password
export OSIN_DB_NAME=osinexample_db
export OSIN_APP_ADDRESS=127.0.0.1:8000
export OSIN_APP_SECRET_KEY=pass-secret-1234566-please-change-me

Register an identity with our system.

go run main.go register -b=Bart -c=Mika [email protected] -e=123password -f=en

Here is how you do password based grant

go run main.go osin_password [email protected] --password=123password

Simple login, run and then copy+paste the result export to the terminal

go run main.go login [email protected] --password=123password

Check we are able to access our protected resource

go run main.go tenant_retrieve --id=1

Let's refresh our access token with our refresh token.

go run main.go osin_refresh_token

Get our token from the client credentials.

go run main.go osin_client_credential

Get new refresh API

go run main.go refresh_token -b=xxx
Owner
Bartlomiej Mika
Technical Consultant
Bartlomiej Mika
Similar Resources

Immutable transaction isolated sql driver for golang

Single transaction based sql.Driver for GO Package txdb is a single transaction based database sql driver. When the connection is opened, it starts a

Jan 6, 2023

HTTP mock for Golang: record and replay HTTP/HTTPS interactions for offline testing

govcr A Word Of Warning I'm in the process of partly rewriting govcr to offer better support for cassette mutations. This is necessary because when I

Dec 28, 2022

HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Jan 3, 2023

A test-friendly replacement for golang's time package

timex timex is a test-friendly replacement for the time package. Usage Just replace your time.Now() by a timex.Now() call, etc. Mocking Use timex.Over

Dec 21, 2022

An implementation of failpoints for Golang.

An implementation of failpoints for Golang.

failpoint An implementation of failpoints for Golang. Fail points are used to add code points where errors may be injected in a user controlled fashio

Jan 2, 2023

mockery - A mock code autogenerator for Golang

mockery - A mock code autogenerator for Golang

mockery - A mock code autogenerator for Golang

Jan 8, 2023

Cucumber for golang

Cucumber for golang

Godog The API is likely to change a few times before we reach 1.0.0 Please read the full README, you may find it very useful. And do not forget to pee

Jan 4, 2023

Go (Golang) Fake Data Generator for Struct

Go (Golang)  Fake Data  Generator for Struct

Docs faker Struct Data Fake Generator Faker will generate you a fake data based on your Struct. Index Support Getting Started Example Limitation Contr

Dec 22, 2022

Check your internet speed right from your terminal. Built on GOlang using chromedp

Check your internet speed right from your terminal. Built on GOlang using chromedp

adhocore/fast A GO lang command line tool to check internet speed right from the terminal. Uses fast.com through headless chrome. Prerequistie Chrome

Dec 26, 2022
Example basic fundamental testing in golang
Example basic fundamental testing in golang

Golang Fundamental Testing Example write basic fundamental testing in Golang Installation $ go mod download || go get . Implementation Case 01_testing

Jun 1, 2022
An example of using Oracle DB with Golang

Golang Oracle DB Example This is a small example of connect and use Oracle DB in Golang Container Database: Username: SYS Role: SYSDBA Password: Orado

Nov 22, 2022
Go buildinfo package Example

Go buildinfo package Example Usage Build the binary: $ go build . Get the build info for the resulting binary: $ ./buildinfo -binary buildinfo Outpu

Oct 11, 2022
Example usage of github.com/go-webauthn/webauthn

Example This is an example go + React application which shows off the functionality of the github.com/go-webauthn/webauthn library. Features This proj

Sep 26, 2022
Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.
Fortio load testing library, command line tool, advanced echo server and web UI in go (golang). Allows to specify a set query-per-second load and record latency histograms and other useful stats.

Fortio Fortio (Φορτίο) started as, and is, Istio's load testing tool and now graduated to be its own project. Fortio is also used by, among others, Me

Jan 2, 2023
Golang HTTP client testing framework

flute Golang HTTP client testing framework Presentation https://speakerdeck.com/szksh/flute-golang-http-client-testing-framework Overview flute is the

Sep 27, 2022
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs
Extremely flexible golang deep comparison, extends the go testing package and tests HTTP APIs

go-testdeep Extremely flexible golang deep comparison, extends the go testing package. Latest news Synopsis Description Installation Functions Availab

Dec 22, 2022
Cucumber for golang
Cucumber for golang

Godog The API is likely to change a few times before we reach 1.0.0 Please read the full README, you may find it very useful. And do not forget to pee

Jan 7, 2023
Testing API Handler written in Golang.

Gofight API Handler Testing for Golang Web framework. Support Framework Http Handler Golang package http provides HTTP client and server implementatio

Dec 16, 2022
Sql mock driver for golang to test database interactions

Sql driver mock for Golang sqlmock is a mock library implementing sql/driver. Which has one and only purpose - to simulate any sql driver behavior in

Dec 31, 2022