github.com/cs3org/reva/v2@v2.27.7/pkg/appauth/appauth.go (about)

     1  // Copyright 2018-2021 CERN
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  // In applying this license, CERN does not waive the privileges and immunities
    16  // granted to it by virtue of its status as an Intergovernmental Organization
    17  // or submit itself to any jurisdiction.
    18  
    19  package appauth
    20  
    21  import (
    22  	"context"
    23  
    24  	apppb "github.com/cs3org/go-cs3apis/cs3/auth/applications/v1beta1"
    25  	authpb "github.com/cs3org/go-cs3apis/cs3/auth/provider/v1beta1"
    26  	userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
    27  	typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
    28  )
    29  
    30  // Manager is the interface that manages application authentication mechanisms.
    31  type Manager interface {
    32  	// GenerateAppPassword creates a password with specified scope to be used by
    33  	// third-party applications.
    34  	GenerateAppPassword(ctx context.Context, scope map[string]*authpb.Scope, label string, expiration *typespb.Timestamp) (*apppb.AppPassword, error)
    35  	// ListAppPasswords lists the application passwords created by a user.
    36  	ListAppPasswords(ctx context.Context) ([]*apppb.AppPassword, error)
    37  	// InvalidateAppPassword invalidates a generated password.
    38  	InvalidateAppPassword(ctx context.Context, secret string) error
    39  	// GetAppPassword retrieves the password information by the combination of username and password.
    40  	GetAppPassword(ctx context.Context, user *userpb.UserId, secret string) (*apppb.AppPassword, error)
    41  }