Categorygithub.com/hyperscale-stack/grpcoauth
modulepackage
1.0.0
Repository: https://github.com/hyperscale-stack/grpcoauth.git
Documentation: pkg.go.dev

# README

Hyperscale gRPC OAuth Last release Documentation

Go Report Card

BranchStatusCoverage
masterBuild StatusCoveralls

The Hyperscale grpcoauth library provides a simple gRPC credentials.PerRPCCredentials with OAuth

Example

package main

import (
    "github.com/hyperscale-stack/grpcoauth"
)

func main() {
    cert := ...

    authF := func(ctx context.Context, creds *OAuthCredentials) (context.Context, error) {
		// implements your business logic for authenticate
        // creds contains AccessToken or ClientID and ClientSecret

		return ctx, nil
	}

    opts := []grpc.ServerOption{
		grpc.Creds(credentials.NewServerTLSFromCert(&cert)),
		grpc.UnaryInterceptor(UnaryServerInterceptor(authF)),
	}

	gsrv := grpc.NewServer(opts...)


    // init gRPC Dial and init service
    greeter := ...

    _, err = greeter.SayHello(ctx, &greeterv1.SayHelloRequest{}, grpcoauth.PerRPCTokenCredentials("feadbb35-c2be-4529-b2a6-19109e07eaa3"))
}

License

Hyperscale grpcoauth is licensed under the MIT license.

# Functions

PerRPCClientIDCredentials returns a CallOption that sets credentials.PerRPCCredentials with OAuth2 client_id and secret for a call.
PerRPCTokenCredentials returns a CallOption that sets credentials.PerRPCCredentials with OAuth2 token for a call.
No description provided by the author
No description provided by the author
WithPerRPCClientIDCredentials returns a DialOption which sets OAuth2 client_id and secret credentials and places auth state on each outbound RPC.
WithPerRPCTokenCredentials returns a DialOption which sets OAuth2 token credentials and places auth state on each outbound RPC.

# Structs

No description provided by the author

# Type aliases

No description provided by the author