| 24 | |
| 25 | |
| 26 | AuthMethodList::AuthMethodList(CephContext *cct, std::string str) |
| 27 | { |
| 28 | std::list<std::string> sup_list; |
| 29 | get_str_list(str, sup_list); |
| 30 | if (sup_list.empty()) { |
| 31 | lderr(cct) << "WARNING: empty auth protocol list" << dendl; |
| 32 | } |
| 33 | for (auto iter = sup_list.begin(); iter != sup_list.end(); ++iter) { |
| 34 | ldout(cct, 5) << "adding auth protocol: " << *iter << dendl; |
| 35 | if (iter->compare("cephx") == 0) { |
| 36 | auth_supported.push_back(CEPH_AUTH_CEPHX); |
| 37 | } else if (iter->compare("none") == 0) { |
| 38 | auth_supported.push_back(CEPH_AUTH_NONE); |
| 39 | } else if (iter->compare("gss") == 0) { |
| 40 | auth_supported.push_back(CEPH_AUTH_GSS); |
| 41 | } else { |
| 42 | auth_supported.push_back(CEPH_AUTH_UNKNOWN); |
| 43 | lderr(cct) << "WARNING: unknown auth protocol defined: " << *iter << dendl; |
| 44 | } |
| 45 | } |
| 46 | if (auth_supported.empty()) { |
| 47 | lderr(cct) << "WARNING: no auth protocol defined, use 'cephx' by default" << dendl; |
| 48 | auth_supported.push_back(CEPH_AUTH_CEPHX); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | bool AuthMethodList::is_supported_auth(int auth_type) |
| 53 | { |