diff --git a/cmd/server/main.go b/cmd/server/main.go index 202ae11..790c30f 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -71,7 +71,7 @@ func main() { // Start listening for requests. srv := grpc.NewServer() - proto.RegisterUsersServer(srv, server.NewUsersServer(&config.Secret, db)) + proto.RegisterUsersServer(srv, server.NewUsersServer(config.Secret, db)) log.Printf("Listening on :%d", config.Port) srv.Serve(lis) } diff --git a/server/server.go b/server/server.go index abc7f54..0eafcf2 100644 --- a/server/server.go +++ b/server/server.go @@ -16,11 +16,11 @@ import ( type usersServer struct { proto.UsersServer - secret *string + secret string db *gorm.DB } -func NewUsersServer(secret *string, db *gorm.DB) proto.UsersServer { +func NewUsersServer(secret string, db *gorm.DB) proto.UsersServer { db.AutoMigrate(&models.User{}, &models.Role{}, &models.Session{}, &models.PasswordToken{}) return &usersServer{ secret: secret, @@ -124,7 +124,7 @@ func (m *usersServer) Logout(ctx context.Context, in *proto.LogoutRequest) (*pro func (m *usersServer) Authorize(ctx context.Context, in *proto.AuthorizeRequest) (*proto.AuthorizeResponse, error) { // Make sure the secrets match. - if in.Secret != *m.secret { + if in.Secret != m.secret { return nil, errors.New("Secrets do not match.") } @@ -233,7 +233,7 @@ func (m *usersServer) ChangePassword(ctx context.Context, in *proto.ChangePasswo func (m *usersServer) ListRoles(ctx context.Context, in *proto.ListRolesRequest) (*proto.ListRolesResponse, error) { // Make sure the secrets match. - if in.Secret != *m.secret { + if in.Secret != m.secret { return nil, errors.New("Secrets do not match.") } @@ -256,7 +256,7 @@ func (m *usersServer) ListRoles(ctx context.Context, in *proto.ListRolesRequest) func (m *usersServer) SetRoles(ctx context.Context, in *proto.SetRolesRequest) (*proto.SetRolesResponse, error) { // Make sure the secrets match. - if in.Secret != *m.secret { + if in.Secret != m.secret { return nil, errors.New("Secrets do not match.") }