Changeset 96 for dataportal


Ignore:
Timestamp:
25/02/05 17:03:00 (16 years ago)
Author:
nbennett
Message:

final version before web services testing

Location:
dataportal/trunk/acmnerc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • dataportal/trunk/acmnerc/src/uk/ac/cclrc/authorisation/server/ACWebService.java

    r78 r96  
    1212import org.apache.log4j.*; 
    1313import uk.ac.cclrc.authorisation.Config; 
     14import java.sql.*; 
    1415/** 
    1516 * The web service class acts as an interface for external services to request for authorisation token. To request for 
     
    2021    static Logger log = Logger.getLogger(ACWebService.class); 
    2122    /** This method is used to get authorisation Token describing the parameters of the user in XML string 
    22      *@param String proxyCertificateInString proxyCertificate of the user in String 
     23     *@param String userCert proxyCertificate of the user in String 
    2324     *@exception java.lang.Exception 
    2425     *@return String XML string representation of the Authorizatino token for the user 
     
    3839    } 
    3940     
    40     /** This method is used to get authorisation Token describing the parameters of the user in XML string 
    41      *@param String proxyCertificateInString proxyCertificate of the user in String 
     41    /** This method is used to get authorisation Token describing the parameters of the user as a proxy certificate string 
     42     *@param String userCert proxyCertificate of the user in String 
    4243     *@exception java.lang.Exception 
    43      *@return String XML string representation of the Authorizatino token for the user 
     44     *@return org.w3c.dom.Element DOM Element representation of the Authorisation token for the user 
    4445     */ 
    4546    public org.w3c.dom.Element getAuthorisationTokenInDOMElement(String userCert) throws Exception { 
     
    5859        } 
    5960    } 
     61     
     62    /** This method is used to get authorisation Token describing the parameters of the user in XML string 
     63     *@param String userCert proxyCertificate of the user in String 
     64     *@param org.w3c.dom.Element extAuthToken external authorisation token 
     65     *@exception java.lang.Exception 
     66     *@return org.w3c.dom.Element DOM Element representation of the Authorisation token for the user 
     67     */ 
     68    public org.w3c.dom.Element getAuthorisationTokenInDOMElement(String userCert, org.w3c.dom.Element extAuthToken) throws Exception { 
     69        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     70         
     71        try { 
     72            ACServer acServer = new ACServer(); 
     73                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     74                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     75                        userDn = credential.getName().toString(); 
     76                         */ 
     77            return acServer.getAuthorisationTokenInDOM(userCert, extAuthToken); 
     78        } catch (Exception e) { 
     79            log.error(e); 
     80            throw e; 
     81        } 
     82    }     
     83     
     84    /** This method is used to search the database for the user.  This search is done by user DN. 
     85     *@param String proxyCert Proxy certificate of the user.  The user's DN is extracted from this. 
     86     *@exception java.lang.Exception 
     87     *@exception java.lang.ClassNotFoundException 
     88     *@exception java.sql.SQLException 
     89     *@return boolean true/false indicates whether user was found in database or not. 
     90     */ 
     91    public boolean searchDBForUser( String proxyCert ) throws ClassNotFoundException, SQLException, Exception 
     92    { 
     93        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     94         
     95        try { 
     96            ACServer acServer = new ACServer(); 
     97                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     98                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     99                        userDn = credential.getName().toString(); 
     100                         */ 
     101            return acServer.searchDBForUser( proxyCert ); 
     102        } catch (Exception e) { 
     103            log.error(e); 
     104            throw e; 
     105        } 
     106    }     
     107     
     108    /** This method is used to find out who this data centre's trusted hosts are from the database. 
     109     * It does not take into account which individual role mappings a user may need to access a given dataset 
     110     *@exception java.lang.Exception 
     111     *@return java.util.HashSet the list of trusted hosts 
     112     */     
     113    public HashSet getTrustedHostsFromDB() throws Exception 
     114    { 
     115        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     116         
     117        try { 
     118            ACServer acServer = new ACServer(); 
     119                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     120                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     121                        userDn = credential.getName().toString(); 
     122                         */ 
     123            return acServer.getTrustedHostsFromDB(); 
     124        } catch (Exception e) { 
     125            log.error(e); 
     126            throw e; 
     127        } 
     128    } 
     129     
     130    /** This method is used to find out who this data centre's trusted hosts are from the database. 
     131     * It takes into account which individual role mappings a user needs to access a given dataset 
     132     *@param String roles a comma-separated list of local roles that are needed to access a given dataset at this data centre 
     133     *@exception java.lang.Exception 
     134     *@return java.util.HashSet the list of trusted hosts 
     135     */     
     136    public HashSet getTrustedHostsFromDB( String roles ) throws Exception 
     137    { 
     138        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     139         
     140        try { 
     141            ACServer acServer = new ACServer(); 
     142                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     143                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     144                        userDn = credential.getName().toString(); 
     145                         */ 
     146            return acServer.getTrustedHostsFromDB( roles ); 
     147        } catch (Exception e) { 
     148            log.error(e); 
     149            throw e; 
     150        } 
     151    } 
     152     
     153    /** This method is used to find out who this data centre's trusted hosts are from the mapping file. 
     154     * It takes into account which individual role mappings a user needs to access a given dataset 
     155     *@param String roles a comma-separated list of local roles that are needed to access a given dataset at this data centre 
     156     *@exception java.lang.Exception 
     157     *@return java.util.HashSet the list of trusted hosts 
     158     */         
     159    public HashSet getTrustedHostsFromMapFile( String roles ) throws Exception 
     160    { 
     161        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     162         
     163        try { 
     164            ACServer acServer = new ACServer(); 
     165                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     166                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     167                        userDn = credential.getName().toString(); 
     168                         */ 
     169            return acServer.getTrustedHostsFromMapFile( roles ); 
     170        } catch (Exception e) { 
     171            log.error(e); 
     172            throw e; 
     173        } 
     174             
     175    } 
     176     
     177    /** This method is used to find out who this data centre's trusted hosts are from the mapping file. 
     178     * It does not take into account which individual role mappings a user may need to access a given dataset 
     179     *@exception java.lang.Exception 
     180     *@return java.util.HashSet the list of trusted hosts 
     181     */         
     182    public HashSet getTrustedHostsFromMapFile() throws Exception 
     183    { 
     184        PropertyConfigurator.configure(Config.getContextPath()+"logger.properties"); 
     185         
     186        try { 
     187            ACServer acServer = new ACServer(); 
     188                        /* GlobusCredential globusCredential = new GlobusCredential(new ByteArrayInputStream(userCert.getBytes()) 
     189                        GSSCredential credential = new GlobusGSSCredentialImpl(globusCredential, GSSCredential.INITIATE_AND_ACCEPT); 
     190                        userDn = credential.getName().toString(); 
     191                         */ 
     192            return acServer.getTrustedHostsFromMapFile(); 
     193        } catch (Exception e) { 
     194            log.error(e); 
     195            throw e; 
     196        } 
     197    } 
     198                 
    60199} 
  • dataportal/trunk/acmnerc/src/uk/ac/cclrc/authorisation/unittest/TestWSServer.java

    r78 r96  
    2525    public TestWSServer(String[] args) { 
    2626        try{ 
    27             URL url1 = new URL("file:///c:/cred.ws");                // System.out.println(url); 
     27            //URL url1 = new URL("file:///c:/cred.ws"); 
     28            // System.out.println(url); 
     29            URL url1 = new URL("file:///D:/Neil/X509up_u_ndb23"); 
    2830            URLConnection con = url1.openConnection(); 
    2931            InputStream in2 = con.getInputStream(); 
     
    4244            String cert3 = cert.toString(); 
    4345             
    44             String endpoint =   "http://tiber:8080/acmbadc/services/ACServer";            Service  service = new Service(); 
     46            String endpoint =   "http://tiber:8080/acmbadc/services/ACServer"; // needs changing - NDB 
     47            Service  service = new Service(); 
    4548            Call     call    = (Call) service.createCall(); 
    4649             
  • dataportal/trunk/acmnerc/web/WEB-INF/conf/authorisation_badc.prop

    r93 r96  
    6262map_file_location=D:\\badc_map_file.txt 
    6363 
    64 token_lifetime=00:02:30 
     64token_lifetime=00:02:01 
    6565 
    6666#two options: file or database 
    6767mapping_preference=file 
     68 
     69#path to the directory where signed authorisation tokens are stored 
     70base_path=C:/signedTokens/ 
  • dataportal/trunk/acmnerc/web/WEB-INF/conf/authorisation_ceh.prop

    r93 r96  
    6464#two options: file or database 
    6565mapping_preference=file 
     66 
     67#path to the directory where signed authorisation tokens are stored 
     68base_path=C:/signedTokens/ 
  • dataportal/trunk/acmnerc/web/WEB-INF/conf/badc_map_file.txt

    r93 r96  
    11<?xml version="1.0"?> 
    22<AAmap> 
     3 
    34<trusted name='BODC'> 
    45<ServerCertFile>D:\\dataportal\\acmnerc\\web\\WEB-INF\\nerc.cert</ServerCertFile> 
     
    1011<role remote='mfmb' local='postdoc'/> 
    1112</trusted> 
     13 
    1214<trusted name='CEH'> 
    1315<ServerCertFile>D:\\dataportal\\acmnerc\\web\\WEB-INF\\nerc.cert</ServerCertFile> 
Note: See TracChangeset for help on using the changeset viewer.