~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/security_context.h

  • Committer: Patrick Crews
  • Date: 2010-12-07 20:02:50 UTC
  • Revision ID: gleebix@gmail.com-20101207200250-6a27jgqalgw5bsb5
Added disabled.def file to disable drizzleslap due to Bug#684269.  Need to skip for tarball release this round

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
24
#include <string>
 
25
 
 
26
namespace drizzled
 
27
{
 
28
 
 
29
/**
 
30
  @class SecurityContext
 
31
  @brief A set of Session members describing the current authenticated user.
 
32
*/
 
33
 
 
34
class SecurityContext {
 
35
public:
 
36
  enum PasswordType
 
37
  {
 
38
    PLAIN_TEXT,
 
39
    MYSQL_HASH
 
40
  };
 
41
 
 
42
  SecurityContext():
 
43
    password_type(PLAIN_TEXT)
 
44
  { }
 
45
 
 
46
  const std::string& getIp() const
 
47
  {
 
48
    return ip;
 
49
  }
 
50
 
 
51
  void setIp(const char *newip)
 
52
  {
 
53
    ip.assign(newip);
 
54
  }
 
55
 
 
56
  const std::string& getUser() const
 
57
  {
 
58
    return user;
 
59
  }
 
60
 
 
61
  void setUser(const std::string &newuser)
 
62
  {
 
63
    user.assign(newuser);
 
64
  }
 
65
 
 
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
 
 
86
private:
 
87
  PasswordType password_type;
 
88
  std::string user;
 
89
  std::string ip;
 
90
  std::string password_context;
 
91
};
 
92
 
 
93
} /* namespace drizzled */
 
94
 
 
95
#endif /* DRIZZLED_SECURITY_CONTEXT_H */