/
connection.go
36 lines (30 loc) · 1004 Bytes
/
connection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package connection
import (
"context"
"github.com/aerogear/charmil-plugin-example/pkg/api"
)
type Config struct {
RequireAuth bool
RequireMASAuth bool
}
// DefaultConfigSkipMasAuth is used when running commands which do not require authenticatation with MAS-SSO
var DefaultConfigSkipMasAuth = &Config{
RequireAuth: true,
RequireMASAuth: false,
}
// DefaultConfigRequireMasAuth is used when running commands which must authenticate with MAS-SSO
var DefaultConfigRequireMasAuth = &Config{
RequireAuth: true,
RequireMASAuth: true,
}
// Connection is an interface which defines methods for interacting
// with the control plane API and the authentication server
//go:generate moq -out connection_mock.go . Connection
type Connection interface {
// Method to refresh the OAuth tokens
RefreshTokens(ctx context.Context) error
// Method to perform a logout request to the authentication server
Logout(ctx context.Context) error
// Method to create the API clients
API() *api.API
}