~drizzle-trunk/drizzle/development

851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
21
#ifndef DRIZZLED_SECURITY_CONTEXT_H
22
#define DRIZZLED_SECURITY_CONTEXT_H
23
1317.1.4 by Monty Taylor
Added string to security_context header so that the header can be used.
24
#include <string>
25
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
26
namespace drizzled
27
{
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
28
29
/**
1273.11.1 by Dennis Schoen
rename class
30
  @class SecurityContext
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
31
  @brief A set of Session members describing the current authenticated user.
32
*/
33
1273.11.1 by Dennis Schoen
rename class
34
class SecurityContext {
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
35
public:
1337.4.4 by Eric Day
Fixed authentication plugin checks, added required functionality for protocol/auth plugins to specify password type and context.
36
  enum PasswordType
37
  {
38
    PLAIN_TEXT,
39
    MYSQL_HASH
40
  };
41
42
  SecurityContext():
43
    password_type(PLAIN_TEXT)
44
  { }
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
45
1273.11.6 by Dennis Schoen
add some const madness
46
  const std::string& getIp() const
1273.11.2 by Dennis Schoen
make data members private
47
  {
48
    return ip;
49
  }
1273.11.5 by Dennis Schoen
add getSecurityContext()
50
1273.11.7 by Dennis Schoen
add second getSecurityContext() function that returns a non-const refernce
51
  void setIp(const char *newip)
1273.11.2 by Dennis Schoen
make data members private
52
  {
53
    ip.assign(newip);
54
  }
55
1273.11.6 by Dennis Schoen
add some const madness
56
  const std::string& getUser() const
1273.11.2 by Dennis Schoen
make data members private
57
  {
58
    return user;
59
  }
1273.11.5 by Dennis Schoen
add getSecurityContext()
60
1857.4.1 by Monty Taylor
Added string sys_var type.
61
  void setUser(const std::string &newuser)
1273.11.2 by Dennis Schoen
make data members private
62
  {
63
    user.assign(newuser);
64
  }
65
1337.4.4 by Eric Day
Fixed authentication plugin checks, added required functionality for protocol/auth plugins to specify password type and context.
66
  PasswordType getPasswordType(void) const
67
  {
68
    return password_type;
69
  }
70
71
  void setPasswordType(PasswordType newpassword_type)
72
  {
73
    password_type= newpassword_type;
74
  }
75
76
  const std::string& getPasswordContext() const
77
  {
78
    return password_context;
79
  }
80
81
  void setPasswordContext(const char *newpassword_context, size_t size)
82
  {
83
    password_context.assign(newpassword_context, size);
84
  }
85
1273.11.2 by Dennis Schoen
make data members private
86
private:
1337.4.4 by Eric Day
Fixed authentication plugin checks, added required functionality for protocol/auth plugins to specify password type and context.
87
  PasswordType password_type;
1273.11.7 by Dennis Schoen
add second getSecurityContext() function that returns a non-const refernce
88
  std::string user;
89
  std::string ip;
1337.4.4 by Eric Day
Fixed authentication plugin checks, added required functionality for protocol/auth plugins to specify password type and context.
90
  std::string password_context;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
91
};
92
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
93
} /* namespace drizzled */
94
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
95
#endif /* DRIZZLED_SECURITY_CONTEXT_H */