-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathauthorization.go
More file actions
38 lines (32 loc) · 1.12 KB
/
authorization.go
File metadata and controls
38 lines (32 loc) · 1.12 KB
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
package mobilepkg
import (
"context"
"github.com/cloudtrust/common-service/log"
api "github.com/cloudtrust/keycloak-bridge/api/mobile"
"github.com/cloudtrust/keycloak-bridge/internal/keycloakb"
)
// Creates constants for API method names
const (
GetUserInformation = "GetUserInformation"
)
// Tracking middleware at component level.
type authorizationComponentMW struct {
logger log.Logger
configDBModule keycloakb.ConfigurationDBModule
next Component
}
// MakeAuthorizationMobileComponentMW checks authorization and return an error if the action is not allowed.
func MakeAuthorizationMobileComponentMW(logger log.Logger, configDBModule keycloakb.ConfigurationDBModule) func(Component) Component {
return func(next Component) Component {
return &authorizationComponentMW{
logger: logger,
configDBModule: configDBModule,
next: next,
}
}
}
// authorizationComponentMW implements Component.
func (c *authorizationComponentMW) GetUserInformation(ctx context.Context) (api.UserInformationRepresentation, error) {
// No restriction for this call
return c.next.GetUserInformation(ctx)
}