irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_auth_manager.cpp
Go to the documentation of this file.
1 #include "irods_auth_manager.hpp"
2 #include "irods_auth_plugin.hpp"
3 
4 namespace irods {
5 // =-=-=-=-=-=-=-
6 // globally available auth manager
8 
10  // TODO - stub
11  }
12 
14  const auth_manager& _rhs ) {
15  plugins_ = _rhs.plugins_;
16  }
17 
19  // TODO - stub
20  }
21 
23  const std::string& _key,
24  auth_ptr& _value ) {
25  error result = SUCCESS();
26 
27  if ( ( result = ASSERT_ERROR( !_key.empty(), SYS_INVALID_INPUT_PARAM, "Empty plugin name." ) ).ok() ) {
28 
29  if ( ( result = ASSERT_ERROR( plugins_.has_entry( _key ), SYS_INVALID_INPUT_PARAM, "No auth plugin found for name: \"%s\".",
30  _key.c_str() ) ).ok() ) {
31  _value = plugins_[_key];
32  }
33  }
34  return result;
35  }
36 
37  // =-=-=-=-=-=-=-
38  // function to load and return an initialized auth plugin
40  auth_ptr& _plugin,
41  const std::string& _plugin_name,
42  const std::string& _inst_name,
43  const std::string& _context ) {
44  error result = SUCCESS();
45 
46  // =-=-=-=-=-=-=-
47  // call generic plugin loader
48  auth* ath = 0;
49  error ret = load_plugin< auth >(
50  ath,
51  _plugin_name,
53  _inst_name,
54  _context );
55  if ( ( result = ASSERT_PASS( ret, "Failed to load plugin: \"%s\".", _plugin_name.c_str() ) ).ok() ) {
56  if ( ( result = ASSERT_ERROR( ath, SYS_INVALID_INPUT_PARAM, "Invalid auth plugin." ) ).ok() ) {
57  _plugin.reset( ath );
58  }
59  }
60 
61  return result;
62 
63  } // load_auth_plugin
64 
66  const int& _proc_type,
67  const std::string& _type,
68  const std::string& _key,
69  const std::string& _inst,
70  const std::string& _ctx,
71  auth_ptr& _rtn_auth ) {
72  error result = SUCCESS();
73  error ret;
74  auth_ptr auth;
75 
76  std::string type = _type;
77  if( CLIENT_PT == _proc_type ) {
78  type += "_client";
79  }
80  else {
81  type += "_server";
82  }
83 
84  ret = load_auth_plugin( auth, type, _inst, _ctx );
85  if ( ( result = ASSERT_PASS( ret, "Failed to load auth plugin." ) ).ok() ) {
86  plugins_[_key] = auth;
87  _rtn_auth = plugins_[_key];
88  }
89 
90  return result;
91  }
92 
93 }; // namespace irods
irods::auth_manager::init_from_type
error init_from_type(const int &, const std::string &_type, const std::string &_key, const std::string &_inst, const std::string &_ctx, auth_ptr &_rtn_auth)
Definition: irods_auth_manager.cpp:65
irods::auth_manager::plugins_
lookup_table< auth_ptr > plugins_
Definition: irods_auth_manager.hpp:39
irods::auth_manager
Definition: irods_auth_manager.hpp:15
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
irods::auth
Definition: irods_auth_plugin.hpp:17
ASSERT_ERROR
#define ASSERT_ERROR(expr_, code_, format_,...)
Definition: irods_error.hpp:123
irods::auth_manager::~auth_manager
virtual ~auth_manager()
Definition: irods_auth_manager.cpp:18
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods::PLUGIN_TYPE_AUTHENTICATION
const std::string PLUGIN_TYPE_AUTHENTICATION("auth")
irods
Definition: apiHandler.hpp:35
ASSERT_PASS
#define ASSERT_PASS(prev_error_, format_,...)
Definition: irods_error.hpp:124
irods::lookup_table::has_entry
bool has_entry(KeyType _k) const
Definition: irods_lookup_table.hpp:41
irods::auth_manager::auth_manager
auth_manager()
Definition: irods_auth_manager.cpp:9
irods_auth_manager.hpp
CLIENT_PT
#define CLIENT_PT
Definition: rodsDef.h:77
irods::auth_manager::resolve
error resolve(const std::string &_key, auth_ptr &_value)
Definition: irods_auth_manager.cpp:22
irods::error
Definition: irods_error.hpp:23
irods_auth_plugin.hpp
irods::load_auth_plugin
static error load_auth_plugin(auth_ptr &_plugin, const std::string &_plugin_name, const std::string &_inst_name, const std::string &_context)
Definition: irods_auth_manager.cpp:39
irods::auth_mgr
auth_manager auth_mgr
Definition: irods_auth_manager.cpp:7
type
int type
Definition: filesystem.cpp:103
irods::auth_ptr
boost::shared_ptr< auth > auth_ptr
Definition: irods_auth_types.hpp:19