Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TAuthenticate.h

Go to the documentation of this file.
00001 // @(#)root/net:$Name:  $:$Id: TAuthenticate.h,v 1.5 2002/03/20 18:47:30 rdm Exp $
00002 // Author: Fons Rademakers   26/11/2000
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TAuthenticate
00013 #define ROOT_TAuthenticate
00014 
00015 
00017 //                                                                      //
00018 // TAuthenticate                                                        //
00019 //                                                                      //
00020 // An authentication module for ROOT based network services, like rootd //
00021 // and proofd.                                                          //
00022 //                                                                      //
00024 
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031 
00032 
00033 class TSocket;
00034 
00035 typedef Int_t (*SecureAuth_t)(TSocket *sock, const char *user,
00036                               const char *passwd, const char *remote);
00037 typedef Int_t (*Krb5Auth_t)(TSocket *sock, TString &user);
00038 
00039 
00040 class TAuthenticate : public TObject {
00041 
00042 public:
00043    enum ESecurity { kClear, kSRP, kKrb5 }; // type of authentication
00044 
00045 private:
00046    TString   fUser;      // user to be authenticated
00047    TString   fPasswd;    // user's password
00048    TString   fProtocol;  // remote service (rootd, proofd)
00049    TString   fRemote;    // remote host to which we want to connect
00050    TSocket  *fSocket;    // connection to remote daemon
00051    ESecurity fSecurity;  // logon security level
00052 
00053    static TString       fgUser;
00054    static TString       fgPasswd;
00055    static SecureAuth_t  fgSecAuthHook;
00056    static Krb5Auth_t    fgKrb5AuthHook;
00057 
00058 public:
00059    TAuthenticate(TSocket *sock, const char *remote, const char *proto,
00060                  Int_t security);
00061    virtual ~TAuthenticate() { }
00062 
00063    Bool_t      Authenticate();
00064    Bool_t      CheckNetrc(TString &user, TString &passwd);
00065    const char *GetUser() const { return fUser.Data(); }
00066    const char *GetPasswd() const { return fPasswd.Data(); }
00067 
00068    static const char *GetGlobalUser();
00069    static const char *GetGlobalPasswd();
00070    static void        SetGlobalUser(const char *user);
00071    static void        SetGlobalPasswd(const char *passwd);
00072    static char       *PromptUser(const char *remote);
00073    static char       *PromptPasswd(const char *prompt = "Password: ");
00074    static void        SetSecureAuthHook(SecureAuth_t func);
00075    static void        SetKrb5AuthHook(Krb5Auth_t func);
00076    static void        AuthError(const char *where, Int_t error);
00077 
00078    ClassDef(TAuthenticate,0)  // Class providing remote authentication service
00079 };
00080 
00081 #endif

Generated on Thu Dec 18 14:52:16 2003 for ROOT by doxygen1.2.16