-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9755 from kobergj/AppTokenApi
App Token API
- Loading branch information
Showing
10 changed files
with
705 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Enhancement: Add an API to auth-app service | ||
|
||
Adds an API to create, list and delete app tokens. Includes an impersonification feature for migration scenarios. | ||
|
||
https://github.com/owncloud/ocis/pull/9755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package http | ||
|
||
import ( | ||
"context" | ||
|
||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" | ||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" | ||
"github.com/owncloud/ocis/v2/ocis-pkg/log" | ||
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" | ||
"github.com/owncloud/ocis/v2/services/auth-app/pkg/config" | ||
"github.com/urfave/cli/v2" | ||
"go.opentelemetry.io/otel/trace" | ||
) | ||
|
||
// Option defines a single option function. | ||
type Option func(o *Options) | ||
|
||
// Options defines the available options for this package. | ||
type Options struct { | ||
Logger log.Logger | ||
Context context.Context | ||
Config *config.Config | ||
Flags []cli.Flag | ||
Namespace string | ||
GatewaySelector pool.Selectable[gateway.GatewayAPIClient] | ||
RoleClient settingssvc.RoleService | ||
TracerProvider trace.TracerProvider | ||
} | ||
|
||
// newOptions initializes the available default options. | ||
func newOptions(opts ...Option) Options { | ||
opt := Options{} | ||
|
||
for _, o := range opts { | ||
o(&opt) | ||
} | ||
|
||
return opt | ||
} | ||
|
||
// Logger provides a function to set the logger option. | ||
func Logger(val log.Logger) Option { | ||
return func(o *Options) { | ||
o.Logger = val | ||
} | ||
} | ||
|
||
// Context provides a function to set the context option. | ||
func Context(val context.Context) Option { | ||
return func(o *Options) { | ||
o.Context = val | ||
} | ||
} | ||
|
||
// Config provides a function to set the config option. | ||
func Config(val *config.Config) Option { | ||
return func(o *Options) { | ||
o.Config = val | ||
} | ||
} | ||
|
||
// Flags provides a function to set the flags option. | ||
func Flags(val []cli.Flag) Option { | ||
return func(o *Options) { | ||
o.Flags = append(o.Flags, val...) | ||
} | ||
} | ||
|
||
// Namespace provides a function to set the Namespace option. | ||
func Namespace(val string) Option { | ||
return func(o *Options) { | ||
o.Namespace = val | ||
} | ||
} | ||
|
||
// GatewaySelector provides a function to configure the gateway client selector | ||
func GatewaySelector(gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) Option { | ||
return func(o *Options) { | ||
o.GatewaySelector = gatewaySelector | ||
} | ||
} | ||
|
||
// RoleClient adds a grpc client for the role service | ||
func RoleClient(rs settingssvc.RoleService) Option { | ||
return func(o *Options) { | ||
o.RoleClient = rs | ||
} | ||
} | ||
|
||
// TracerProvider provides a function to set the TracerProvider option | ||
func TracerProvider(val trace.TracerProvider) Option { | ||
return func(o *Options) { | ||
o.TracerProvider = val | ||
} | ||
} |
Oops, something went wrong.