scopegen

command module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 12 Imported by: 0

README

About

scopegen is a protoc code generator, that reads OAuth2 scope definitions from services and generates code for supported languages.

It is intended for use with gunk, but it is usable as a separate protoc generator. It does not depend on gunk.

Supported Languages

Currently, scopegen supports:

  • Go
  • JSON

Installation

Use the following command to install scopegen:

$ go get -u github.com/gunk/scopegen

This will place scopegen in your $GOBIN

Usage

In your project's .gunkconfig add the following:

[generate]
    command=scopegen
    go=true
    json=true
    output_version=2

Output Version

Output version is configured with output_version configuration key, valid values are: 1, 2. Output version 2 generates codes in a simplified form that doesn't use any custom type and preserve the scope name, description. Output version 1 is kept only for backward compatible, and will be deprecated soon.

Example:

Output version 1:

{"/test.Service/GetMessage":["read","write"],"/test.Service/GetMessage3":["read"]}

Output version 2:

{"scopes":{"admin":"Grants read and write access to administrative information","read":"Grants read access","write":"Grants write access"},"auth_scopes":{"/test.Service/GetMessage":["read","write"],"/test.Service/GetMessage3":["read"]}}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL