(file) Return to peg_authorization.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 kumpf 1.9 //%/////////////////////////////////////////////////////////////////////////////
  2 mday  1.1 //
  3 kumpf 1.9 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4           // The Open Group, Tivoli Systems
  5 mday  1.1 //
  6           // Permission is hereby granted, free of charge, to any person obtaining a copy
  7           // of this software and associated documentation files (the "Software"), to
  8           // deal in the Software without restriction, including without limitation the
  9           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10           // sell copies of the Software, and to permit persons to whom the Software is
 11           // furnished to do so, subject to the following conditions:
 12 kumpf 1.9 // 
 13 mday  1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21           //
 22           //==============================================================================
 23           //
 24           // Author: Mike Day (mdday@us.ibm.com) << Fri Mar 29 10:43:02 2002 mdd >>
 25           //
 26           // Modified By:
 27           //
 28           //%/////////////////////////////////////////////////////////////////////////////
 29           
 30           
 31           #include "peg_authorization.h"
 32           
 33           PEGASUS_NAMESPACE_BEGIN
 34 mday  1.1 PEGASUS_USING_STD;
 35           
 36           const Uint32 peg_identity_types::USERNAME =                   0x00000001;
 37           const Uint32 peg_identity_types::LDAP_DN  =                   0x00000002;
 38           const Uint32 peg_identity_types::GUID     =                   0x00000003;
 39           const Uint32 peg_identity_types::X509     =                   0x00000004;
 40           const Uint32 peg_identity_types::PKCS6    =                   0x00000005;
 41           const Uint32 peg_identity_types::HTTP_DIGEST_USER_AND_REALM = 0x00000006;
 42           const Uint32 peg_identity_types::UNIX_ID =                    0x00000007;
 43 mday  1.3 const Uint32 peg_identity_types::INTERNAL =                   0x00000008;
 44 mday  1.1 
 45           const Uint32 peg_credential_types::CLEAR_PASSWORD =           0x00000001;
 46           const Uint32 peg_credential_types::CRYPT_PASSWORD =           0x00000002;
 47           const Uint32 peg_credential_types::HTTP_DIGEST =              0x00000003;
 48 mday  1.3 const Uint32 peg_credential_types::SERVICE =                  0x00000004;
 49           const Uint32 peg_credential_types::MODULE =                   0x00000005;
 50           const Uint32 peg_credential_types::PROVIDER =                 0x00000006;
 51 mday  1.1 
 52 mday  1.7 pegasus_basic_identity::pegasus_basic_identity(const pegasus_basic_identity & id)
 53              : Base(), _username(id._username), _password(id._password)
 54 mday  1.1 {
 55 mday  1.7    
 56 mday  1.1 }
 57           
 58 mday  1.7 pegasus_basic_identity::~pegasus_basic_identity(void)
 59 mday  1.1 {
 60           }
 61           
 62 mday  1.7 
 63           pegasus_basic_identity & pegasus_basic_identity::operator= (const pegasus_basic_identity & id)
 64 mday  1.1 {
 65 mday  1.5    if(this != &id)
 66 mday  1.1    {
 67 mday  1.7       _username.clear();
 68                 _username = id._username;
 69                 _password.clear();
 70                 _password = id._password;
 71 mday  1.1    }
 72 mday  1.4    return *this;
 73           }
 74 mday  1.1 
 75 mday  1.7 Boolean pegasus_basic_identity::operator== (const pegasus_basic_identity & id) const
 76 mday  1.1 {
 77 mday  1.7    if ( _username == id._username) 
 78                 return true;
 79              return false;
 80 mday  1.1 }
 81           
 82 mday  1.7 String pegasus_basic_identity::get_id_string(void) const 
 83 mday  1.1 {
 84 mday  1.7    return String(_username);
 85 mday  1.1 }
 86           
 87 mday  1.7 String pegasus_basic_identity::get_cred_string(void) const 
 88 mday  1.1 {
 89 mday  1.7    return String(_password);
 90 mday  1.5 }
 91           
 92 mday  1.7 Uint32 pegasus_basic_identity::get_id_type(void) const
 93 mday  1.5 {
 94 mday  1.7    return peg_identity_types::USERNAME;
 95 mday  1.1 }
 96 mday  1.7 
 97           Uint32 pegasus_basic_identity::get_credential_type(void) const 
 98 mday  1.2 {
 99 mday  1.7    return peg_credential_types::CLEAR_PASSWORD;
100 mday  1.2 }
101           
102 mday  1.7 Boolean pegasus_basic_identity::authenticate(void)
103 mday  1.1 {
104 mday  1.7    return true;
105 mday  1.1 }
106           
107 mday  1.7 pegasus_identity *pegasus_basic_identity::create_id(void) const
108 mday  1.1 {
109 mday  1.7    return(new pegasus_basic_identity(*this));
110 mday  1.1 }
111           
112 mday  1.7 pegasus_internal_identity::pegasus_internal_identity(Uint32 cred)
113              :_id(peg_identity_types::INTERNAL), _credential(cred)
114 mday  1.3 {
115 mday  1.7    
116 mday  1.3 }
117           
118           pegasus_internal_identity::pegasus_internal_identity(const pegasus_internal_identity & id)
119 mday  1.7    :Base(), _id(id._id), _credential(id._credential)
120 mday  1.3 {
121 mday  1.7    
122 mday  1.5 }
123           
124 mday  1.7 
125           pegasus_internal_identity & pegasus_internal_identity::operator= ( const pegasus_internal_identity & id)
126 mday  1.5 {
127              if(this != &id)
128              {
129 mday  1.7       _id = id._id;
130                 _credential = id._credential;
131 mday  1.5    }
132 mday  1.7    
133 mday  1.5    return *this;
134 mday  1.3 }
135           
136 mday  1.7 Boolean pegasus_internal_identity::operator== (const pegasus_internal_identity & id) const 
137           {
138              if( _id == id._id)
139                 if( _credential == id._credential)
140           	 return true;
141              return false;
142           }
143           
144           
145           String pegasus_internal_identity::get_id_string(void) const
146 mday  1.3 {
147 mday  1.7    if( _credential == peg_credential_types::SERVICE )
148                 return String("INTERNAL::SERVICE");
149              if( _credential == peg_credential_types::MODULE)
150                 return String("INTERNAL::MODULE");
151              if( _credential == peg_credential_types::PROVIDER)
152                 return String("INTERNAL::PROVIDER");
153              return String("INTERNAL::UNKNOWN");
154 mday  1.3 }
155           
156 mday  1.7 String pegasus_internal_identity::get_cred_string(void) const
157 mday  1.3 {
158 mday  1.8    return get_id_string(); 
159 mday  1.7 
160           }
161           
162           
163           Uint32 pegasus_internal_identity::get_id_type(void) const 
164           {
165              return _id;
166           }
167           
168           Uint32 pegasus_internal_identity::get_credential_type(void) const
169           {
170              return _credential;
171 mday  1.3 }
172           
173           Boolean pegasus_internal_identity::authenticate(void)
174           {
175 mday  1.7    if( _id == peg_identity_types::INTERNAL)
176              {
177                 if( _credential == peg_credential_types::SERVICE || 
178           	  _credential == peg_credential_types::MODULE || 
179           	  _credential == peg_credential_types::PROVIDER)
180           	 return true;
181              }
182 mday  1.3    return false;
183 mday  1.7 }
184           
185           pegasus_identity * pegasus_internal_identity::create_id() const 
186           {
187              return new pegasus_internal_identity(*this);
188 mday  1.1 }
189           
190           
191           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2