1 /* 2 Copyright The ORAS Authors. 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 16 package auth 17 18 import ( 19 "context" 20 "errors" 21 "net/http" 22 23 "github.com/containerd/containerd/remotes" 24 ) 25 26 // Common errors 27 var ( 28 ErrNotLoggedIn = errors.New("not logged in") 29 ) 30 31 // Client provides authentication operations for remotes. 32 type Client interface { 33 // Login logs in to a remote server identified by the hostname. 34 // Deprecated: use LoginWithOpts 35 Login(ctx context.Context, hostname, username, secret string, insecure bool) error 36 // LoginWithOpts logs in to a remote server identified by the hostname with custom options 37 LoginWithOpts(options ...LoginOption) error 38 // Logout logs out from a remote server identified by the hostname. 39 Logout(ctx context.Context, hostname string) error 40 // Resolver returns a new authenticated resolver. 41 // Deprecated: use ResolverWithOpts 42 Resolver(ctx context.Context, client *http.Client, plainHTTP bool) (remotes.Resolver, error) 43 // ResolverWithOpts returns a new authenticated resolver with custom options. 44 ResolverWithOpts(options ...ResolverOption) (remotes.Resolver, error) 45 } 46