nextcloud

package
v0.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package nextcloud verifies a clientID and clientSecret against a Nextcloud backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNextcloudServerMock

func GetNextcloudServerMock(called *[]string) http.Handler

GetNextcloudServerMock returns a handler that pretends to be a remote Nextcloud server

func New

func New(m map[string]interface{}) (auth.Manager, error)

New returns an auth manager implementation that verifies against a Nextcloud backend.

func TestingHTTPClient

func TestingHTTPClient(handler http.Handler) (*http.Client, func())

TestingHTTPClient thanks to https://itnext.io/how-to-stub-requests-to-remote-hosts-with-go-6c2c1db32bf2 Ideally, this function would live in tests/helpers, but if we put it there, it gets excluded by .dockerignore, and the Docker build fails (see https://github.com/cs3org/reva/issues/1999) So putting it here for now - open to suggestions if someone knows a better way to inject this.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action describes a REST request to forward to the Nextcloud backend

type AuthManagerConfig

type AuthManagerConfig struct {
	EndPoint     string `mapstructure:"endpoint" docs:";The Nextcloud backend endpoint for user check"`
	SharedSecret string `mapstructure:"shared_secret"`
	MockHTTP     bool   `mapstructure:"mock_http"`
}

AuthManagerConfig contains config for a Nextcloud-based AuthManager

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the Nextcloud-based implementation of the auth.Manager interface see https://github.com/cs3org/reva/blob/v1.13.0/pkg/auth/auth.go#L32-L35

func NewAuthManager

func NewAuthManager(c *AuthManagerConfig) (*Manager, error)

NewAuthManager returns a new Nextcloud-based AuthManager

func (*Manager) Authenticate

func (am *Manager) Authenticate(ctx context.Context, clientID, clientSecret string) (*user.User, map[string]*authpb.Scope, error)

Authenticate method as defined in https://github.com/cs3org/reva/blob/28500a8/pkg/auth/auth.go#L31-L33

func (*Manager) Configure

func (am *Manager) Configure(ml map[string]interface{}) error

Configure method as defined in https://github.com/cs3org/reva/blob/v1.13.0/pkg/auth/auth.go#L32-L35

func (*Manager) SetHTTPClient

func (am *Manager) SetHTTPClient(c *http.Client)

SetHTTPClient sets the HTTP client

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response contains data for the Nextcloud mock server to respond and to switch to a new server state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL