1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2009-2011 New Dream Network
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "AuthAuthorizeHandler.h"
16 #include "cephx/CephxAuthorizeHandler.h"
17 #include "none/AuthNoneAuthorizeHandler.h"
18 #include "common/Mutex.h"
20 AuthAuthorizeHandler *AuthAuthorizeHandlerRegistry::get_handler(int protocol)
22 if (!supported.is_supported_auth(protocol)) {
26 Mutex::Locker l(m_lock);
27 map<int,AuthAuthorizeHandler*>::iterator iter = m_authorizers.find(protocol);
28 if (iter != m_authorizers.end())
33 m_authorizers[protocol] = new AuthNoneAuthorizeHandler();
34 return m_authorizers[protocol];
37 m_authorizers[protocol] = new CephxAuthorizeHandler();
38 return m_authorizers[protocol];
43 AuthAuthorizeHandlerRegistry::~AuthAuthorizeHandlerRegistry()
45 for (map<int,AuthAuthorizeHandler*>::iterator iter = m_authorizers.begin();
46 iter != m_authorizers.end();