oidc

package
v0.3.10-0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// map[at_hash:KgtZpGvTuIaud0SVcmmkKQ aud:example-app email:kilgore@kilgore.trout email_verified:true exp:1593434672 groups:["authors"] iat:1593348272 iss:http://127.0.0.1:5556/dex name:Kilgore Trout sub:Cg0wLTM4NS0yODA4OS0wEgRtb2Nr]
	DexOIDCTemplate = api.SOIDCIdpConfigOptions{
		Scopes: []string{
			"openid",
			"email",
			"groups",
			"profile",
		},
		SIdpAttributeOptions: api.SIdpAttributeOptions{
			UserNameAttribute:        "name",
			UserIdAttribute:          "sub",
			UserEmailAttribute:       "email",
			UserDisplaynameAttribtue: "name",
		},
	}
	// https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
	// map[avatar_url:https://avatars1.githubusercontent.com/u/1121362?v=4 bio: blog:https://yunion.io collaborators:0 company:Yunion.io created_at:2011-10-12T04:18:27Z disk_usage:925302 email: events_url:https://api.github.com/users/swordqiu/events{/privacy} followers:13 followers_url:https://api.github.com/users/swordqiu/followers following:1 following_url:https://api.github.com/users/swordqiu/following{/other_user} gists_url:https://api.github.com/users/swordqiu/gists{/gist_id} gravatar_id: hireable: html_url:https://github.com/swordqiu
	// id:1121362 location:Beijing, China
	// login:swordqiu name:Jian Qiu
	// node_id:MDQ6VXNlcjExMjEzNjI= organizations_url:https://api.github.com/users/swordqiu/orgs owned_private_repos:0 plan:{"name":"free","space":976562499,"collaborators":0,"private_repos":10000} private_gists:0 public_gists:0 public_repos:37 received_events_url:https://api.github.com/users/swordqiu/received_events repos_url:https://api.github.com/users/swordqiu/repos site_admin:false starred_url:https://api.github.com/users/swordqiu/starred{/owner}{/repo} subscriptions_url:https://api.github.com/users/swordqiu/subscriptions total_private_repos:0 twitter_username: two_factor_authentication:false type:User updated_at:2020-06-29T01:39:42Z url:https://api.github.com/users/swordqiu]
	GithubOIDCTemplate = api.SOIDCIdpConfigOptions{
		Scopes: []string{
			"user",
		},
		AuthUrl:     "https://github.com/login/oauth/authorize",
		TokenUrl:    "https://github.com/login/oauth/access_token",
		UserinfoUrl: "https://api.github.com/user",
		TimeoutSecs: 60,
		SIdpAttributeOptions: api.SIdpAttributeOptions{
			UserIdAttribute:          "id",
			UserNameAttribute:        "login",
			UserEmailAttribute:       "email",
			UserDisplaynameAttribtue: "name",
		},
	}

	// {
	//  "sub": "112176790568447731603",
	//  "name": "Jian Qiu",
	//  "given_name": "Jian",
	//  "family_name": "Qiu",
	//  "picture": "https://lh3.googleusercontent.com/a/AATXAJyj32UmKhmwI38ljm8xI53LX4Lw3w5wYxKsj4JS\u003ds96-c",
	//  "email": "swordqiu@gmail.com",
	//  "email_verified": true,
	//  "locale": "zh-CN"
	// }
	GoogleOIDCTemplate = api.SOIDCIdpConfigOptions{
		Endpoint: "https://accounts.google.com",
		SIdpAttributeOptions: api.SIdpAttributeOptions{
			UserIdAttribute:          "sub",
			UserNameAttribute:        "email",
			UserEmailAttribute:       "email",
			UserDisplaynameAttribtue: "name",
		},
	}

	AzureADTemplate = api.SOIDCIdpConfigOptions{
		Scopes: []string{
			"openid",
			"profile",
			"email",
		},
		TimeoutSecs: 60,
		SIdpAttributeOptions: api.SIdpAttributeOptions{
			UserIdAttribute:          "sub",
			UserNameAttribute:        "name",
			UserEmailAttribute:       "email",
			UserDisplaynameAttribtue: "name",
		},
	}
)

Functions

func NewOIDCDriver

func NewOIDCDriver(idpId, idpName, template, targetDomainId string, conf api.TConfigs) (driver.IIdentityBackend, error)

Types

type SOIDCDriver

type SOIDCDriver struct {
	driver.SBaseIdentityDriver
	// contains filtered or unexported fields
}

OpenID Connect client driver https://openid.net/specs/openid-connect-basic-1_0.html https://tools.ietf.org/html/rfc6749

func (*SOIDCDriver) Authenticate

func (*SOIDCDriver) GetSsoRedirectUri

func (oidc *SOIDCDriver) GetSsoRedirectUri(ctx context.Context, callbackUrl, state string) (string, error)

func (*SOIDCDriver) Probe

func (self *SOIDCDriver) Probe(ctx context.Context) error

func (*SOIDCDriver) Sync

func (self *SOIDCDriver) Sync(ctx context.Context) error

type SOIDCDriverClass

type SOIDCDriverClass struct{}

func (*SOIDCDriverClass) ForceSyncUser

func (self *SOIDCDriverClass) ForceSyncUser() bool

func (*SOIDCDriverClass) GetDefaultIconUri

func (self *SOIDCDriverClass) GetDefaultIconUri(tmpName string) string

func (*SOIDCDriverClass) IsSso

func (self *SOIDCDriverClass) IsSso() bool

func (*SOIDCDriverClass) Name

func (self *SOIDCDriverClass) Name() string

func (*SOIDCDriverClass) NewDriver

func (self *SOIDCDriverClass) NewDriver(idpId, idpName, template, targetDomainId string, conf api.TConfigs) (driver.IIdentityBackend, error)

func (*SOIDCDriverClass) SingletonInstance

func (self *SOIDCDriverClass) SingletonInstance() bool

func (*SOIDCDriverClass) SyncMethod

func (self *SOIDCDriverClass) SyncMethod() string

func (*SOIDCDriverClass) ValidateConfig

func (self *SOIDCDriverClass) ValidateConfig(ctx context.Context, userCred mcclient.TokenCredential, template string, tconf api.TConfigs, idpId, domainId string) (api.TConfigs, error)

Jump to

Keyboard shortcuts

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