blob: 84cf483aaafc51c19d404855544e9521d409efce (
plain)
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
37
38
39
40
41
42
43
44
|
package embed
import (
"context"
"github.com/sirupsen/logrus"
"github.com/authelia/authelia/v4/internal/configuration/schema"
"github.com/authelia/authelia/v4/internal/middlewares"
)
// Context is an interface used in various areas of Authelia to simplify access to important elements like the
// configuration, providers, and logger.
type Context interface {
GetLogger() *logrus.Entry
GetProviders() middlewares.Providers
GetConfiguration() *schema.Configuration
context.Context
}
type ctxEmbed struct {
Configuration *Configuration
Providers Providers
Logger *logrus.Entry
context.Context
}
func (c *ctxEmbed) GetConfiguration() *schema.Configuration {
return c.Configuration.ToInternal()
}
func (c *ctxEmbed) GetProviders() middlewares.Providers {
return c.Providers.ToInternal()
}
func (c *ctxEmbed) GetLogger() *logrus.Entry {
return c.Logger
}
var (
_ middlewares.Context = (*ctxEmbed)(nil)
)
|