1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_ucbhelper.hxx" 30 #include <com/sun/star/ucb/CertificateValidationRequest.hpp> 31 #include <ucbhelper/simplecertificatevalidationrequest.hxx> 32 33 using namespace com::sun::star; 34 using namespace ucbhelper; 35 36 //========================================================================= 37 SimpleCertificateValidationRequest::SimpleCertificateValidationRequest( const sal_Int32 & lCertificateValidity, 38 const com::sun::star::uno::Reference<com::sun::star::security::XCertificate> pCertificate, 39 const rtl::OUString & hostname) 40 { 41 // Fill request... 42 ucb::CertificateValidationRequest aRequest; 43 aRequest.CertificateValidity = lCertificateValidity; 44 aRequest.Certificate = pCertificate; 45 aRequest.HostName = hostname; 46 47 setRequest( uno::makeAny( aRequest ) ); 48 49 uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 ); 50 aContinuations[ 0 ] = new InteractionAbort( this ); 51 aContinuations[ 1 ] = new InteractionApprove( this ); 52 53 setContinuations( aContinuations ); 54 pCertificate.get(); 55 } 56 57 //========================================================================= 58 sal_Int32 SimpleCertificateValidationRequest::getResponse() const 59 { 60 rtl::Reference< InteractionContinuation > xSelection = getSelection(); 61 if ( xSelection.is() ) 62 { 63 InteractionContinuation * pSelection = xSelection.get(); 64 65 uno::Reference< task::XInteractionAbort > xAbort( 66 pSelection, uno::UNO_QUERY ); 67 if ( xAbort.is() ) 68 return 1; 69 70 uno::Reference< task::XInteractionRetry > xRetry( 71 pSelection, uno::UNO_QUERY ); 72 if ( xRetry.is() ) 73 return 2; 74 75 uno::Reference< task::XInteractionApprove > xApprove( 76 pSelection, uno::UNO_QUERY ); 77 if ( xApprove.is() ) 78 return 4; 79 80 uno::Reference< task::XInteractionDisapprove > xDisapprove( 81 pSelection, uno::UNO_QUERY ); 82 if ( xDisapprove.is() ) 83 return 8; 84 85 OSL_ENSURE( sal_False, "CertificateValidationRequest - Unknown continuation!" ); 86 } 87 return 0; 88 } 89