github.com/pachyderm/pachyderm@v1.13.4/src/server/auth/testing/auth.go (about)

     1  package testing
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/pachyderm/pachyderm/src/client/auth"
     7  	"github.com/pachyderm/pachyderm/src/client/pfs"
     8  	"github.com/pachyderm/pachyderm/src/server/pkg/transactionenv/txncontext"
     9  )
    10  
    11  // InactiveAPIServer (in the auth/testing package) is an implementation of the
    12  // pachyderm auth api that returns NotActivatedError for all requests. This is
    13  // meant to be used with local PFS and PPS servers for testing, and should
    14  // never be used in a real Pachyderm cluster
    15  type InactiveAPIServer struct{}
    16  
    17  // Activate implements the Activate RPC, but just returns NotActivatedError
    18  func (a *InactiveAPIServer) Activate(context.Context, *auth.ActivateRequest) (*auth.ActivateResponse, error) {
    19  	return nil, auth.ErrNotActivated
    20  }
    21  
    22  // Deactivate implements the Deactivate RPC, but just returns NotActivatedError
    23  func (a *InactiveAPIServer) Deactivate(context.Context, *auth.DeactivateRequest) (*auth.DeactivateResponse, error) {
    24  	return nil, auth.ErrNotActivated
    25  }
    26  
    27  // GetAdmins implements the GetAdmins RPC, but just returns NotActivatedError
    28  func (a *InactiveAPIServer) GetAdmins(context.Context, *auth.GetAdminsRequest) (*auth.GetAdminsResponse, error) {
    29  	return nil, auth.ErrNotActivated
    30  }
    31  
    32  // GetClusterRoleBindings implements the GetClusterRoleBindings RPC, but just returns NotActivatedError
    33  func (a *InactiveAPIServer) GetClusterRoleBindings(context.Context, *auth.GetClusterRoleBindingsRequest) (*auth.GetClusterRoleBindingsResponse, error) {
    34  	return nil, auth.ErrNotActivated
    35  }
    36  
    37  // ModifyClusterRoleBinding implements the ModifyClusterRoleBinding RPC, but just returns NotActivatedError
    38  func (a *InactiveAPIServer) ModifyClusterRoleBinding(context.Context, *auth.ModifyClusterRoleBindingRequest) (*auth.ModifyClusterRoleBindingResponse, error) {
    39  	return nil, auth.ErrNotActivated
    40  }
    41  
    42  // ModifyAdmins implements the ModifyAdmins RPC, but just returns NotActivatedError
    43  func (a *InactiveAPIServer) ModifyAdmins(context.Context, *auth.ModifyAdminsRequest) (*auth.ModifyAdminsResponse, error) {
    44  	return nil, auth.ErrNotActivated
    45  }
    46  
    47  // Authenticate implements the Authenticate RPC, but just returns NotActivatedError
    48  func (a *InactiveAPIServer) Authenticate(context.Context, *auth.AuthenticateRequest) (*auth.AuthenticateResponse, error) {
    49  	return nil, auth.ErrNotActivated
    50  }
    51  
    52  // Authorize implements the Authorize RPC, but just returns NotActivatedError
    53  func (a *InactiveAPIServer) Authorize(context.Context, *auth.AuthorizeRequest) (*auth.AuthorizeResponse, error) {
    54  	return nil, auth.ErrNotActivated
    55  }
    56  
    57  // AuthorizeInTransaction is the same as the Authorize RPC but for use inside a
    58  // running transaction.  It also returns a NotActivatedError.
    59  func (a *InactiveAPIServer) AuthorizeInTransaction(*txncontext.TransactionContext, *auth.AuthorizeRequest) (*auth.AuthorizeResponse, error) {
    60  	return nil, auth.ErrNotActivated
    61  }
    62  
    63  // WhoAmI implements the WhoAmI RPC, but just returns NotActivatedError
    64  func (a *InactiveAPIServer) WhoAmI(context.Context, *auth.WhoAmIRequest) (*auth.WhoAmIResponse, error) {
    65  	return nil, auth.ErrNotActivated
    66  }
    67  
    68  // SetScope implements the SetScope RPC, but just returns NotActivatedError
    69  func (a *InactiveAPIServer) SetScope(context.Context, *auth.SetScopeRequest) (*auth.SetScopeResponse, error) {
    70  	return nil, auth.ErrNotActivated
    71  }
    72  
    73  // SetScopeInTransaction is the same as the SetScope RPC but for use inside a
    74  // running transaction.  It also returns a NotActivatedError.
    75  func (a *InactiveAPIServer) SetScopeInTransaction(*txncontext.TransactionContext, *auth.SetScopeRequest) (*auth.SetScopeResponse, error) {
    76  	return nil, auth.ErrNotActivated
    77  }
    78  
    79  // GetScope implements the GetScope RPC, but just returns NotActivatedError
    80  func (a *InactiveAPIServer) GetScope(context.Context, *auth.GetScopeRequest) (*auth.GetScopeResponse, error) {
    81  	return nil, auth.ErrNotActivated
    82  }
    83  
    84  // GetScopeInTransaction is the same as the GetScope RPC but for use inside a
    85  // running transaction.  It also returns a NotActivatedError.
    86  func (a *InactiveAPIServer) GetScopeInTransaction(*txncontext.TransactionContext, *auth.GetScopeRequest) (*auth.GetScopeResponse, error) {
    87  	return nil, auth.ErrNotActivated
    88  }
    89  
    90  // GetACL implements the GetACL RPC, but just returns NotActivatedError
    91  func (a *InactiveAPIServer) GetACL(context.Context, *auth.GetACLRequest) (*auth.GetACLResponse, error) {
    92  	return nil, auth.ErrNotActivated
    93  }
    94  
    95  // GetACLInTransaction is the same as the GetACL RPC but for use inside a
    96  // running transaction.  It also returns a NotActivatedError.
    97  func (a *InactiveAPIServer) GetACLInTransaction(*txncontext.TransactionContext, *auth.GetACLRequest) (*auth.GetACLResponse, error) {
    98  	return nil, auth.ErrNotActivated
    99  }
   100  
   101  // SetACL implements the SetACL RPC, but just returns NotActivatedError
   102  func (a *InactiveAPIServer) SetACL(context.Context, *auth.SetACLRequest) (*auth.SetACLResponse, error) {
   103  	return nil, auth.ErrNotActivated
   104  }
   105  
   106  // SetACLInTransaction is the same as the SetACL RPC but for use inside a
   107  // running transaction.  It also returns a NotActivatedError.
   108  func (a *InactiveAPIServer) SetACLInTransaction(*txncontext.TransactionContext, *auth.SetACLRequest) (*auth.SetACLResponse, error) {
   109  	return nil, auth.ErrNotActivated
   110  }
   111  
   112  // GetAuthToken implements the GetAuthToken RPC, but just returns NotActivatedError
   113  func (a *InactiveAPIServer) GetAuthToken(context.Context, *auth.GetAuthTokenRequest) (*auth.GetAuthTokenResponse, error) {
   114  	return nil, auth.ErrNotActivated
   115  }
   116  
   117  // GetAuthTokenInTransaction is the same as GetAuthToken but for use inside a running transaction.
   118  func (a *InactiveAPIServer) GetAuthTokenInTransaction(*txncontext.TransactionContext, *auth.GetAuthTokenRequest) (*auth.GetAuthTokenResponse, error) {
   119  	return nil, auth.ErrNotActivated
   120  }
   121  
   122  // GetOIDCLogin implements the GetOIDCLogin RPC, but just returns NotActivatedError
   123  func (a *InactiveAPIServer) GetOIDCLogin(context.Context, *auth.GetOIDCLoginRequest) (*auth.GetOIDCLoginResponse, error) {
   124  	return nil, auth.ErrNotActivated
   125  }
   126  
   127  // ExtendAuthToken implements the ExtendAuthToken RPC, but just returns NotActivatedError
   128  func (a *InactiveAPIServer) ExtendAuthToken(context.Context, *auth.ExtendAuthTokenRequest) (*auth.ExtendAuthTokenResponse, error) {
   129  	return nil, auth.ErrNotActivated
   130  }
   131  
   132  // RevokeAuthToken implements the RevokeAuthToken RPC, but just returns NotActivatedError
   133  func (a *InactiveAPIServer) RevokeAuthToken(context.Context, *auth.RevokeAuthTokenRequest) (*auth.RevokeAuthTokenResponse, error) {
   134  	return nil, auth.ErrNotActivated
   135  }
   136  
   137  // RevokeAuthTokenInTransaction is the same as RevokeAuthToken but for use inside a running transaction
   138  func (a *InactiveAPIServer) RevokeAuthTokenInTransaction(*txncontext.TransactionContext, *auth.RevokeAuthTokenRequest) (*auth.RevokeAuthTokenResponse, error) {
   139  	return nil, auth.ErrNotActivated
   140  }
   141  
   142  // SetGroupsForUser implements the SetGroupsForUser RPC, but just returns NotActivatedError
   143  func (a *InactiveAPIServer) SetGroupsForUser(context.Context, *auth.SetGroupsForUserRequest) (*auth.SetGroupsForUserResponse, error) {
   144  	return nil, auth.ErrNotActivated
   145  }
   146  
   147  // ModifyMembers implements the ModifyMembers RPC, but just returns NotActivatedError
   148  func (a *InactiveAPIServer) ModifyMembers(context.Context, *auth.ModifyMembersRequest) (*auth.ModifyMembersResponse, error) {
   149  	return nil, auth.ErrNotActivated
   150  }
   151  
   152  // GetGroups implements the GetGroups RPC, but just returns NotActivatedError
   153  func (a *InactiveAPIServer) GetGroups(context.Context, *auth.GetGroupsRequest) (*auth.GetGroupsResponse, error) {
   154  	return nil, auth.ErrNotActivated
   155  }
   156  
   157  // GetUsers implements the GetUsers RPC, but just returns NotActivatedError
   158  func (a *InactiveAPIServer) GetUsers(context.Context, *auth.GetUsersRequest) (*auth.GetUsersResponse, error) {
   159  	return nil, auth.ErrNotActivated
   160  }
   161  
   162  // SetConfiguration implements the SetConfiguration RPC, but just returns NotActivatedError
   163  func (a *InactiveAPIServer) SetConfiguration(context.Context, *auth.SetConfigurationRequest) (*auth.SetConfigurationResponse, error) {
   164  	return nil, auth.ErrNotActivated
   165  }
   166  
   167  // GetConfiguration implements the GetConfiguration RPC, but just returns NotActivatedError
   168  func (a *InactiveAPIServer) GetConfiguration(context.Context, *auth.GetConfigurationRequest) (*auth.GetConfigurationResponse, error) {
   169  	return nil, auth.ErrNotActivated
   170  }
   171  
   172  // GetOneTimePassword implements the GetOneTimePassword RPC, but just returns NotActivatedError
   173  func (a *InactiveAPIServer) GetOneTimePassword(context.Context, *auth.GetOneTimePasswordRequest) (*auth.GetOneTimePasswordResponse, error) {
   174  	return nil, auth.ErrNotActivated
   175  }
   176  
   177  // ExtractAuthTokens implements the ExtractAuthTokens RPC, but just returns NotActivatedError
   178  func (a *InactiveAPIServer) ExtractAuthTokens(context.Context, *auth.ExtractAuthTokensRequest) (*auth.ExtractAuthTokensResponse, error) {
   179  	return nil, auth.ErrNotActivated
   180  }
   181  
   182  // RestoreAuthToken implements the RestoreAuthToken RPC, but just returns NotActivatedError
   183  func (a *InactiveAPIServer) RestoreAuthToken(context.Context, *auth.RestoreAuthTokenRequest) (*auth.RestoreAuthTokenResponse, error) {
   184  	return nil, auth.ErrNotActivated
   185  }
   186  
   187  // CheckIsAuthorizedInTransaction implements the internal transaction API
   188  func (a *InactiveAPIServer) CheckIsAuthorizedInTransaction(*txncontext.TransactionContext, *pfs.Repo, auth.Scope) error {
   189  	return nil
   190  }