XRootD
XrdVomsFun.hh
Go to the documentation of this file.
1 #ifndef ___XRD_VOMSFUN_H___
2 #define ___XRD_VOMSFUN_H___
3 /******************************************************************************/
4 /* */
5 /* X r d V o m s F u n . h h */
6 /* */
7 /* (C) 2013 G. Ganis, CERN */
8 /* */
9 /* All rights reserved. The copyright holder's institutional names may not */
10 /* be used to endorse or promote products derived from this software without */
11 /* specific prior written permission. */
12 /* */
13 /* This file is part of the VOMS extraction XRootD plug-in software suite, */
14 /* here after called VOMS-XRootD (see https://github.com/gganis/voms). */
15 /* */
16 /* VOMS-XRootD is free software: you can redistribute it and/or modify it */
17 /* under the terms of the GNU Lesser General Public License as published by */
18 /* the Free Software Foundation, either version 3 of the License, or (at */
19 /* your option) any later version. */
20 /* */
21 /* VOMS-XRootD is distributed in the hope that it will be useful, but */
22 /* WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY or */
23 /* FITNESS FOR A PARTICULAR PURPOSE. */
24 /* See the GNU Lesser General Public License for more details. */
25 /* */
26 /* You should have received a copy of the GNU Lesser General Public License */
27 /* along with VOMS-XRootD in a file called COPYING.LGPL (LGPL license) and */
28 /* file COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
29 /* */
30 /******************************************************************************/
31 
32 #include "openssl/x509.h"
33 #include "openssl/pem.h"
34 
35 #include "XrdOuc/XrdOucHash.hh"
36 #include "XrdOuc/XrdOucString.hh"
37 
38 class XrdSecEntity;
39 class XrdSysError;
40 class XrdSysLogger;
41 class XrdVomsMapfile;
42 
44 {
45 public:
46 
47 // Supported cert formats
48 //
50  {gCertRaw = 0,
51  gCertPEM = 1,
52  gCertX509 = 2
53  };
54 
55 void SetCertFmt(CertFormat n) {gCertFmt = n;}
56 
57 int VOMSFun(XrdSecEntity &ent);
58 
59 int VOMSInit(const char *cfg);
60 
61  XrdVomsFun(XrdSysError &erp);
62 
63  ~XrdVomsFun() {} // Once constructed never deleted (except for Http).
64 
65 private:
66 
67 void FmtExtract(XrdOucString &out, XrdOucString in, const char *tag);
68 void NameOneLine(X509_NAME *nm, XrdOucString &s);
69 void FmtReplace(XrdSecEntity &ent);
70 
71 // These settings are configurable
72 //
73 
74 CertFormat gCertFmt; // certfmt: see constructor
75 short gGrpWhich; // grpopt's which = 0|1|2 [2]
76 short gDebug; // Verbosity control 0 | 1 | 2
77 XrdOucHash<int> gGrps; // hash table with grps=grp1[,grp2,...]
78 XrdOucHash<int> gVOs; // hash table with vos=vo1[,vo2,...]
79 XrdOucString gRequire; // String with configuration options use to:
80 XrdOucString gGrpFmt; // format contents of XrdSecEntity::grps
81 XrdOucString gRoleFmt; // format contents of XrdSecEntity::role
82 XrdOucString gVoFmt; // format contents of XrdSecEntity::vorg
83 
84 XrdSysError &gDest;
85 XrdSysLogger *gLogger;
86 
87 XrdVomsMapfile *m_mapfile{nullptr};
88 };
89 #endif
XrdVomsFun(XrdSysError &erp)
Definition: XrdVomsFun.cc:102
void SetCertFmt(CertFormat n)
Definition: XrdVomsFun.hh:55
int VOMSInit(const char *cfg)
Definition: XrdVomsFun.cc:401
int VOMSFun(XrdSecEntity &ent)
Definition: XrdVomsFun.cc:191