oauth

package
v0.0.0-...-b6f1020 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CallbackPathGithub     = "/v1/oauth/callback/github"
	SuccessPathGithub      = "/v1/oauth/success"
	InstallNewGithubAppUrl = "https://github.com/apps/pg-workstation-test/installations/new"
)
View Source
const (
	// EntryName name of entry
	EntryName = "ws-oauth"
	// EntryType type of entry
	EntryType = "ws-oauth"
	// EntryDescription description of entry
	EntryDescription = "Entry for oauth management entry."
	// GithubCallbackHost describes default callback address
	GithubCallbackHost = "http://localhost:8080"
	// Github type of oauth destination
	Github = "github"

	GithubAppPrivateKey = `` /* 1680-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func CallbackGithub

func CallbackGithub(ctx *gin.Context)

CallbackGithub @Summary Oauth callback @Id 40 @version 1.0 @Tags oauth @produce application/json @Param code query string true "Code" @Success 200 @Router /v1/oauth/callback/github [get]

func GithubOauthScript

func GithubOauthScript(ctx *gin.Context)

GithubOauthScript is temp API while developing. TODO Remove this API at first release

func Index

func Index(ctx *gin.Context)

Index is temp API while developing. TODO Remove this API at first release

func RegisterEntryFromConfig

func RegisterEntryFromConfig(configFilePath string) map[string]rkentry.Entry

RegisterEntryFromConfig is an implementation of: type EntryRegFunc func(string) map[string]rkentry.Entry

func Success

func Success(ctx *gin.Context)

Success is temp API while developing. TODO Remove this API at first release

Types

type BootConfig

type BootConfig struct {
	Oauth struct {
		Enabled bool `yaml:"enabled" json:"enabled"`
		Github  struct {
			Enabled      bool     `yaml:"enabled" json:"enabled"`
			CallbackHost string   `yaml:"callbackHost" json:"callbackHost"`
			ClientId     string   `yaml:"clientId" json:"clientId"`
			ClientSecret string   `yaml:"clientSecret" json:"clientSecret"`
			Scopes       []string `yaml:"scopes" json:"scopes"`
		} `yaml:"github" json:"github"`
		Logger struct {
			ZapLogger struct {
				Ref string `yaml:"ref" json:"ref"`
			} `yaml:"zapLogger" json:"zapLogger"`
			EventLogger struct {
				Ref string `yaml:"ref" json:"ref"`
			} `yaml:"eventLogger" json:"eventLogger"`
		} `yaml:"logger" json:"logger"`
	} `yaml:"oauth" json:"oauth"`
}

BootConfig is a struct which is for unmarshalled YAML

type Entry

type Entry struct {
	EntryName        string                    `json:"entryName" yaml:"entryName"`
	EntryType        string                    `json:"entryType" yaml:"entryType"`
	EntryDescription string                    `json:"entryDescription" yaml:"entryDescription"`
	ZapLoggerEntry   *rkentry.ZapLoggerEntry   `json:"zapLoggerEntry" yaml:"zapLoggerEntry"`
	EventLoggerEntry *rkentry.EventLoggerEntry `json:"eventLoggerEntry" yaml:"eventLoggerEntry"`
	CallbackAddr     string                    `json:"callbackAddr" yaml:"callbackAddr"`
	// contains filtered or unexported fields
}

EntryImpl performs as manager of project and organizations

func GetEntry

func GetEntry() *Entry

GetEntry returns ProjectEntry.

func RegisterEntry

func RegisterEntry(opts ...EntryOption) *Entry

RegisterController will register Entry into GlobalAppCtx

func (*Entry) Bootstrap

func (entry *Entry) Bootstrap(context.Context)

Bootstrap entry

func (*Entry) GetDescription

func (entry *Entry) GetDescription() string

GetDescription returns entry description

func (*Entry) GetGithubUser

func (entry *Entry) GetGithubUser(accessToken string) (*githubClient.User, error)

func (*Entry) GetName

func (entry *Entry) GetName() string

GetName returns entry name

func (*Entry) GetOauthConfig

func (entry *Entry) GetOauthConfig(dest string) (*oauth2.Config, error)

func (*Entry) GetType

func (entry *Entry) GetType() string

GetType returns entry type as project

func (*Entry) Interrupt

func (entry *Entry) Interrupt(context.Context)

Interrupt entry

func (*Entry) IsValidOauthDest

func (entry *Entry) IsValidOauthDest(src string) bool

func (*Entry) String

func (entry *Entry) String() string

String returns entry as string

type EntryOption

type EntryOption func(*Entry)

EntryOption will be extended in future.

func WithOauthConfig

func WithOauthConfig(dest string, config *oauth2.Config) EntryOption

WithOauthConfig provide user

Jump to

Keyboard shortcuts

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