コード例 #1
0
ファイル: user.go プロジェクト: chikin14niwa/gomniauth
// NewUser builds a new User object for Github.
func NewUser(data objx.Map, creds *common.Credentials, provider common.Provider) *User {
	user := &User{data}

	creds.Set(common.CredentialsKeyID, data[spotifyKeyID])
	// set provider credentials
	user.data[common.UserKeyProviderCredentials] = map[string]*common.Credentials{
		provider.Name(): creds,
	}

	return user
}
コード例 #2
0
ファイル: facade.go プロジェクト: chikin14niwa/gomniauth
// ProviderPublicData gets the public data for the specified provider.
//
// The options should contain the `loginpathFormat`, which will determine how the
// loginpath value is created.
func ProviderPublicData(provider common.Provider, options map[string]interface{}) (interface{}, error) {

	optionsx := objx.New(options)

	return map[string]interface{}{
		"name":      provider.Name(),
		"display":   provider.DisplayName(),
		"loginpath": fmt.Sprintf(optionsx.Get("loginpathFormat").Str("auth/%s/login"), provider.Name()),
	}, nil

}