LCOV - code coverage report
Current view: top level - ucbhelper/source/provider - simpleauthenticationrequest.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 53 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/task/XMasterPasswordHandling.hpp>
      21             : #include <com/sun/star/ucb/URLAuthenticationRequest.hpp>
      22             : #include <ucbhelper/simpleauthenticationrequest.hxx>
      23             : 
      24             : using namespace com::sun::star;
      25             : using namespace ucbhelper;
      26             : 
      27             : 
      28           0 : SimpleAuthenticationRequest::SimpleAuthenticationRequest(
      29             :                                       const OUString & rURL,
      30             :                                       const OUString & rServerName,
      31             :                                       const OUString & rRealm,
      32             :                                       const OUString & rUserName,
      33             :                                       const OUString & rPassword,
      34             :                                       const OUString & rAccount,
      35             :                                       bool bAllowPersistentStoring,
      36           0 :                                       bool bAllowUseSystemCredentials )
      37             : {
      38             : 
      39             :     // Fill request...
      40           0 :     ucb::URLAuthenticationRequest aRequest;
      41             : //    aRequest.Message        = // OUString
      42             : //    aRequest.Context        = // XInterface
      43           0 :     aRequest.Classification = task::InteractionClassification_ERROR;
      44           0 :     aRequest.ServerName     = rServerName;
      45             : //    aRequest.Diagnostic     = // OUString
      46           0 :     aRequest.HasRealm       = !rRealm.isEmpty();
      47           0 :     if ( aRequest.HasRealm )
      48           0 :         aRequest.Realm = rRealm;
      49           0 :     aRequest.HasUserName    = sal_True;
      50           0 :     aRequest.UserName       = rUserName;
      51           0 :     aRequest.HasPassword    = sal_True;
      52           0 :     aRequest.Password       = rPassword;
      53           0 :     aRequest.HasAccount     = !rAccount.isEmpty();
      54           0 :     if ( aRequest.HasAccount )
      55           0 :         aRequest.Account = rAccount;
      56           0 :     aRequest.URL = rURL;
      57             : 
      58             :     initialize(aRequest,
      59             :        false,
      60             :        true,
      61             :        true,
      62             :        aRequest.HasAccount,
      63             :        bAllowPersistentStoring,
      64           0 :        bAllowUseSystemCredentials );
      65           0 : }
      66             : 
      67             : 
      68           0 : SimpleAuthenticationRequest::SimpleAuthenticationRequest(
      69             :                                       const OUString & rURL,
      70             :                                       const OUString & rServerName,
      71             :                                       EntityType eRealmType,
      72             :                                       const OUString & rRealm,
      73             :                                       EntityType eUserNameType,
      74             :                                       const OUString & rUserName,
      75             :                                       EntityType ePasswordType,
      76             :                                       const OUString & rPassword,
      77             :                                       EntityType eAccountType,
      78           0 :                                       const OUString & rAccount )
      79             : {
      80             :     // Fill request...
      81           0 :     ucb::URLAuthenticationRequest aRequest;
      82             : //    aRequest.Message        = // OUString
      83             : //    aRequest.Context        = // XInterface
      84           0 :     aRequest.Classification = task::InteractionClassification_ERROR;
      85           0 :     aRequest.ServerName     = rServerName;
      86             : //    aRequest.Diagnostic     = // OUString
      87           0 :     aRequest.HasRealm       = eRealmType != ENTITY_NA;
      88           0 :     if ( aRequest.HasRealm )
      89           0 :         aRequest.Realm = rRealm;
      90           0 :     aRequest.HasUserName    = eUserNameType != ENTITY_NA;
      91           0 :     if ( aRequest.HasUserName )
      92           0 :         aRequest.UserName = rUserName;
      93           0 :     aRequest.HasPassword    = ePasswordType != ENTITY_NA;
      94           0 :     if ( aRequest.HasPassword )
      95           0 :         aRequest.Password = rPassword;
      96           0 :     aRequest.HasAccount     = eAccountType != ENTITY_NA;
      97           0 :     if ( aRequest.HasAccount )
      98           0 :         aRequest.Account = rAccount;
      99           0 :     aRequest.URL = rURL;
     100             : 
     101             :     initialize(aRequest,
     102             :        eRealmType == ENTITY_MODIFY,
     103             :        eUserNameType == ENTITY_MODIFY,
     104             :        ePasswordType == ENTITY_MODIFY,
     105             :        eAccountType == ENTITY_MODIFY,
     106             :        true,
     107           0 :        false );
     108           0 : }
     109             : 
     110             : 
     111           0 : void SimpleAuthenticationRequest::initialize(
     112             :       const ucb::URLAuthenticationRequest & rRequest,
     113             :       bool bCanSetRealm,
     114             :       bool bCanSetUserName,
     115             :       bool bCanSetPassword,
     116             :       bool bCanSetAccount,
     117             :       bool bAllowPersistentStoring,
     118             :       bool bAllowUseSystemCredentials )
     119             : {
     120           0 :     setRequest( uno::makeAny( rRequest ) );
     121             : 
     122             :     // Fill continuations...
     123             :     uno::Sequence< ucb::RememberAuthentication > aRememberModes(
     124           0 :         bAllowPersistentStoring ? 3 : 2 );
     125           0 :     aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
     126           0 :     aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
     127           0 :     if (bAllowPersistentStoring)
     128           0 :         aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT;
     129             : 
     130             :     m_xAuthSupplier
     131           0 :         = new InteractionSupplyAuthentication(
     132             :                 this,
     133             :                 bCanSetRealm,
     134             :                 bCanSetUserName,
     135             :                 bCanSetPassword,
     136             :                 bCanSetAccount,
     137             :                 aRememberModes, // rRememberPasswordModes
     138             :                 ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
     139             :                 aRememberModes, // rRememberAccountModes
     140             :                 ucb::RememberAuthentication_SESSION, // eDefaultRememberAccountMode
     141             :                 bAllowUseSystemCredentials, // bCanUseSystemCredentials,
     142             :                 false // bDefaultUseSystemCredentials
     143           0 :             );
     144             : 
     145             :     uno::Sequence<
     146           0 :         uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
     147           0 :     aContinuations[ 0 ] = new InteractionAbort( this );
     148           0 :     aContinuations[ 1 ] = new InteractionRetry( this );
     149           0 :     aContinuations[ 2 ] = m_xAuthSupplier.get();
     150             : 
     151           0 :     setContinuations( aContinuations );
     152           0 : }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10