chore: rename ProviderLogin api to AuthProvider
This commit is contained in:
parent
8ad84d4278
commit
88cb2b3314
4 changed files with 9 additions and 9 deletions
|
|
@ -189,8 +189,8 @@ type Tariff interface {
|
|||
CurrentPrice() (float64, error) // EUR/kWh, CHF/kWh, ...
|
||||
}
|
||||
|
||||
// ProviderLogin is the ability to provide OAuth authentication through the ui
|
||||
type ProviderLogin interface {
|
||||
// AuthProvider is the ability to provide OAuth authentication through the ui
|
||||
type AuthProvider interface {
|
||||
SetCallbackParams(baseURL, redirectURL string, authenticated chan<- bool)
|
||||
LoginHandler() http.HandlerFunc
|
||||
LogoutHandler() http.HandlerFunc
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ func (cp *ConfigProvider) configureVehicles(conf config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// webControl handles routing for devices. For now only api.ProviderLogin related routes
|
||||
// webControl handles routing for devices. For now only api.AuthProvider related routes
|
||||
func (cp *ConfigProvider) webControl(conf networkConfig, router *mux.Router, paramC chan<- util.Param) {
|
||||
auth := router.PathPrefix("/oauth").Subrouter()
|
||||
auth.Use(handlers.CompressHandler)
|
||||
|
|
@ -258,7 +258,7 @@ func (cp *ConfigProvider) webControl(conf networkConfig, router *mux.Router, par
|
|||
|
||||
var id int
|
||||
for _, v := range cp.vehicles {
|
||||
if provider, ok := v.(api.ProviderLogin); ok {
|
||||
if provider, ok := v.(api.AuthProvider); ok {
|
||||
id += 1
|
||||
|
||||
basePath := fmt.Sprintf("vehicles/%d", id)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
// Mercedes is an api.Vehicle implementation for Mercedes cars
|
||||
type Mercedes struct {
|
||||
*embed
|
||||
api.ProviderLogin
|
||||
api.AuthProvider
|
||||
*mercedes.Provider
|
||||
}
|
||||
|
||||
|
|
@ -64,9 +64,9 @@ func NewMercedesFromConfig(other map[string]interface{}) (api.Vehicle, error) {
|
|||
api := mercedes.NewAPI(log, identity, cc.Sandbox)
|
||||
|
||||
v := &Mercedes{
|
||||
embed: &cc.embed,
|
||||
Provider: mercedes.NewProvider(api, strings.ToUpper(cc.VIN), cc.Cache),
|
||||
ProviderLogin: identity, // expose the OAuth2 login
|
||||
embed: &cc.embed,
|
||||
Provider: mercedes.NewProvider(api, strings.ToUpper(cc.VIN), cc.Cache),
|
||||
AuthProvider: identity, // expose the OAuth2 login
|
||||
}
|
||||
|
||||
return v, nil
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ func (v *Identity) invalidToken() {
|
|||
}
|
||||
}
|
||||
|
||||
var _ api.ProviderLogin = (*Identity)(nil)
|
||||
var _ api.AuthProvider = (*Identity)(nil)
|
||||
|
||||
func (v *Identity) SetCallbackParams(baseURL, redirectURL string, authC chan<- bool) {
|
||||
v.baseURL = baseURL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue