1 | /* |
---|---|
2 | * Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, but |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * for more details. |
13 | */ |
14 | |
15 | #include <QLoggingCategory> |
16 | #include <QString> |
17 | |
18 | #include "creds/credentialsfactory.h" |
19 | #include "creds/httpcredentialsgui.h" |
20 | #include "creds/dummycredentials.h" |
21 | #ifndef NO_SHIBBOLETH |
22 | #include "creds/shibbolethcredentials.h" |
23 | #endif |
24 | |
25 | namespace OCC { |
26 | |
27 | Q_LOGGING_CATEGORY(lcGuiCredentials, "gui.credentials", QtInfoMsg) |
28 | |
29 | namespace CredentialsFactory { |
30 | |
31 | AbstractCredentials *create(const QString &type) |
32 | { |
33 | // empty string might happen for old version of configuration |
34 | if (type == "http"|| type == "") { |
35 | return new HttpCredentialsGui; |
36 | } else if (type == "dummy") { |
37 | return new DummyCredentials; |
38 | #ifndef NO_SHIBBOLETH |
39 | } else if (type == "shibboleth") { |
40 | return new ShibbolethCredentials; |
41 | #endif |
42 | } else { |
43 | qCWarning(lcGuiCredentials, "Unknown credentials type: %s", qPrintable(type)); |
44 | return new DummyCredentials; |
45 | } |
46 | } |
47 | |
48 | } // ns CredentialsFactory |
49 | |
50 | } // namespace OCC |
51 |