auth.go 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Copyright 2016 Nippon Telegraph and Telephone Corporation.
  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. package v3rpc
  15. import (
  16. "github.com/coreos/etcd/etcdserver"
  17. pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
  18. "golang.org/x/net/context"
  19. )
  20. type AuthServer struct {
  21. authenticator etcdserver.Authenticator
  22. }
  23. func NewAuthServer(s *etcdserver.EtcdServer) *AuthServer {
  24. return &AuthServer{authenticator: s}
  25. }
  26. func (as *AuthServer) AuthEnable(ctx context.Context, r *pb.AuthEnableRequest) (*pb.AuthEnableResponse, error) {
  27. return as.authenticator.AuthEnable(ctx, r)
  28. }
  29. func (as *AuthServer) AuthDisable(ctx context.Context, r *pb.AuthDisableRequest) (*pb.AuthDisableResponse, error) {
  30. plog.Info("not implemented yet")
  31. return nil, nil
  32. }
  33. func (as *AuthServer) Authenticate(ctx context.Context, r *pb.AuthenticateRequest) (*pb.AuthenticateResponse, error) {
  34. plog.Info("not implemented yet")
  35. return nil, nil
  36. }
  37. func (as *AuthServer) RoleAdd(ctx context.Context, r *pb.AuthRoleAddRequest) (*pb.AuthRoleAddResponse, error) {
  38. plog.Info("not implemented yet")
  39. return nil, nil
  40. }
  41. func (as *AuthServer) RoleDelete(ctx context.Context, r *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDeleteResponse, error) {
  42. plog.Info("not implemented yet")
  43. return nil, nil
  44. }
  45. func (as *AuthServer) RoleGet(ctx context.Context, r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error) {
  46. plog.Info("not implemented yet")
  47. return nil, nil
  48. }
  49. func (as *AuthServer) RoleRevoke(ctx context.Context, r *pb.AuthRoleRevokeRequest) (*pb.AuthRoleRevokeResponse, error) {
  50. plog.Info("not implemented yet")
  51. return nil, nil
  52. }
  53. func (as *AuthServer) RoleGrant(ctx context.Context, r *pb.AuthRoleGrantRequest) (*pb.AuthRoleGrantResponse, error) {
  54. plog.Info("not implemented yet")
  55. return nil, nil
  56. }
  57. func (as *AuthServer) UserAdd(ctx context.Context, r *pb.AuthUserAddRequest) (*pb.AuthUserAddResponse, error) {
  58. return as.authenticator.UserAdd(ctx, r)
  59. }
  60. func (as *AuthServer) UserDelete(ctx context.Context, r *pb.AuthUserDeleteRequest) (*pb.AuthUserDeleteResponse, error) {
  61. plog.Info("not implemented yet")
  62. return nil, nil
  63. }
  64. func (as *AuthServer) UserGet(ctx context.Context, r *pb.AuthUserGetRequest) (*pb.AuthUserGetResponse, error) {
  65. plog.Info("not implemented yet")
  66. return nil, nil
  67. }
  68. func (as *AuthServer) UserGrant(ctx context.Context, r *pb.AuthUserGrantRequest) (*pb.AuthUserGrantResponse, error) {
  69. plog.Info("not implemented yet")
  70. return nil, nil
  71. }
  72. func (as *AuthServer) UserRevoke(ctx context.Context, r *pb.AuthUserRevokeRequest) (*pb.AuthUserRevokeResponse, error) {
  73. plog.Info("not implemented yet")
  74. return nil, nil
  75. }
  76. func (as *AuthServer) UserChangePassword(ctx context.Context, r *pb.AuthUserChangePasswordRequest) (*pb.AuthUserChangePasswordResponse, error) {
  77. plog.Info("not implemented yet")
  78. return nil, nil
  79. }