00001 #ifndef ___XRD_VOMSFUN_H___ 00002 #define ___XRD_VOMSFUN_H___ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d V o m s F u n . h h */ 00006 /* */ 00007 /* (C) 2013 G. Ganis, CERN */ 00008 /* */ 00009 /* All rights reserved. The copyright holder's institutional names may not */ 00010 /* be used to endorse or promote products derived from this software without */ 00011 /* specific prior written permission. */ 00012 /* */ 00013 /* This file is part of the VOMS extraction XRootD plug-in software suite, */ 00014 /* here after called VOMS-XRootD (see https://github.com/gganis/voms). */ 00015 /* */ 00016 /* VOMS-XRootD is free software: you can redistribute it and/or modify it */ 00017 /* under the terms of the GNU Lesser General Public License as published by */ 00018 /* the Free Software Foundation, either version 3 of the License, or (at */ 00019 /* your option) any later version. */ 00020 /* */ 00021 /* VOMS-XRootD is distributed in the hope that it will be useful, but */ 00022 /* WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY or */ 00023 /* FITNESS FOR A PARTICULAR PURPOSE. */ 00024 /* See the GNU Lesser General Public License for more details. */ 00025 /* */ 00026 /* You should have received a copy of the GNU Lesser General Public License */ 00027 /* along with VOMS-XRootD in a file called COPYING.LGPL (LGPL license) and */ 00028 /* file COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00029 /* */ 00030 /******************************************************************************/ 00031 00032 #include "openssl/x509.h" 00033 #include "openssl/pem.h" 00034 00035 #include "XrdOuc/XrdOucHash.hh" 00036 #include "XrdOuc/XrdOucString.hh" 00037 00038 class XrdSecEntity; 00039 class XrdSysError; 00040 class XrdSysLogger; 00041 00042 class XrdVomsFun 00043 { 00044 public: 00045 00046 // Supported cert formats 00047 // 00048 enum CertFormat 00049 {gCertRaw = 0, 00050 gCertPEM = 1, 00051 gCertX509 = 2 00052 }; 00053 00054 void SetCertFmt(CertFormat n) {gCertFmt = n;} 00055 00056 int VOMSFun(XrdSecEntity &ent); 00057 00058 int VOMSInit(const char *cfg); 00059 00060 XrdVomsFun(XrdSysError &erp); 00061 00062 ~XrdVomsFun() {} // Once constructed never deleted (except for Http). 00063 00064 private: 00065 00066 void FmtExtract(XrdOucString &out, XrdOucString in, const char *tag); 00067 void NameOneLine(X509_NAME *nm, XrdOucString &s); 00068 void FmtReplace(XrdSecEntity &ent); 00069 00070 // These settings are configurable 00071 // 00072 00073 CertFormat gCertFmt; // certfmt: see constructor 00074 short gGrpWhich; // grpopt's which = 0|1|2 [2] 00075 short gDebug; // Verbosity control 0 | 1 | 2 00076 XrdOucHash<int> gGrps; // hash table with grps=grp1[,grp2,...] 00077 XrdOucHash<int> gVOs; // hash table with vos=vo1[,vo2,...] 00078 XrdOucString gRequire; // String with configuration options use to: 00079 XrdOucString gGrpFmt; // format contents of XrdSecEntity::grps 00080 XrdOucString gRoleFmt; // format contents of XrdSecEntity::role 00081 XrdOucString gVoFmt; // format contents of XrdSecEntity::vorg 00082 00083 XrdSysError &gDest; 00084 XrdSysLogger *gLogger; 00085 }; 00086 #endif