Partager via


Extrait de code XML : Utiliser des filtres de nom d’utilisateur et de mot de passe dans un modèle BDC

Dernière modification : mercredi 21 avril 2010

S’applique à : SharePoint Server 2010

Voici un exemple de filtre de nom d’utilisateur et de mot de passe dans un modèle BDC.

Exemple

Le filtre de nom d’utilisateur et de mot de passe nécessite la configuration des propriétés de la Banque d’informations sécurisée comme indiqué.

<LobSystemInstance Name="WCFLobSystemInstance-UserNamePasswordFilter">
  <Properties>
    <!-- SecondarySsoApplicationId is required for UserName and Password Filters-->
    <Property Name="SecondarySsoApplicationId" Type="System.String">SSO</Property>
    <Property Name="SsoApplicationId" Type="System.String">SSO</Property>
    <Property Name="SsoProviderImplementation" Type="System.String">Microsoft.Office.SecureStoreService.Server.SecureStoreProvider, Microsoft.Office.SecureStoreService, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Property>
    <Property Name="WcfAuthenticationMode" Type="System.String">Credentials</Property>
    <Property Name="WcfEndpointAddress" Type="System.String">http://server:port#/Service.svc</Property>
  </Properties>
</LobSystemInstance>

Voici la définition du filtre de nom d’utilisateur et de mot de passe.

<Method IsStatic="false" LobName="GenericMethod" Name="Default" DefaultDisplayName="FinderGenericMethod">
  <AccessControlList>
    <AccessControlEntry Principal="REDMOND\Domain Users">
      <Right BdcRight="Edit" />
      <Right BdcRight="Execute" />
      <Right BdcRight="SetPermissions" />
      <Right BdcRight="SelectableInClients" />
    </AccessControlEntry>
  </AccessControlList>
  <FilterDescriptors>
    <FilterDescriptor Type="Username" Name="UserNameFilter">
      <Properties>
        <Property Name="CaseSensitive" Type="System.Boolean">false</Property>
        <Property Name="IsDefault" Type="System.Boolean">false</Property>
        <Property Name="UsedForDisambiguation" Type="System.Boolean">false</Property>
      </Properties>
    </FilterDescriptor>   
    <FilterDescriptor Type="Password" Name="PasswordFilter">
      <Properties>
        <Property Name="CaseSensitive" Type="System.Boolean">false</Property>
        <Property Name="IsDefault" Type="System.Boolean">false</Property>
        <Property Name="UsedForDisambiguation" Type="System.Boolean">false</Property>
      </Properties>
    </FilterDescriptor>
  </FilterDescriptors>
  <Parameters>
    <Parameter Direction="In" Name="id">
      <TypeDescriptor TypeName="System.Int32" Name="id" />
    </Parameter>
    <Parameter Direction="In" Name="parent">
      <TypeDescriptor TypeName="BCSWebServiceProxy.RootComplexClass, Sample-LobSystemUserNamePasswordFilter" Name="parent">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.Boolean" Name="Gender" />
          <TypeDescriptor TypeName="System.Int32" Name="Integer" />
          <TypeDescriptor TypeName="System.String" AssociatedFilter="UserNameFilter" Name="Name">
            <DefaultValues>
              <DefaultValue MethodInstanceName="FinderGenericMethod" Type="System.String">test1</DefaultValue>
            </DefaultValues>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
    <Parameter Direction="In" Name="son">
      <TypeDescriptor TypeName="BCSWebServiceProxy.BrotherClass, Sample-LobSystemUserNamePasswordFilter" Name="son">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.DateTime" Name="Date">
            <Interpretation>
              <NormalizeDateTime LobDateTimeMode="UTC" />
            </Interpretation>
          </TypeDescriptor>
          <TypeDescriptor TypeName="BCSWebServiceProxy.ThirdClass, Sample-LobSystemUserNamePasswordFilter" Name="Third">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.DateTime" Name="Date">
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" AssociatedFilter="Filter" Name="Integer" />
            </TypeDescriptors>
          </TypeDescriptor>
          <TypeDescriptor TypeName="System.Boolean" Name="Gender" />
          <TypeDescriptor TypeName="System.Int32" Name="Integer" />
          <TypeDescriptor TypeName="System.String" AssociatedFilter="PasswordFilter" Name="Name">
            <DefaultValues>
              <DefaultValue MethodInstanceName="FinderGenericMethod" Type="System.String">test2</DefaultValue>
            </DefaultValues>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
    <Parameter Direction="In" Name="daughter">
      <TypeDescriptor TypeName="BCSWebServiceProxy.SisterClass, Sample-LobSystemUserNamePasswordFilter" Name="daughter">
        <TypeDescriptors>
          <TypeDescriptor TypeName="System.DateTime" Name="Date">
            <Interpretation>
              <NormalizeDateTime LobDateTimeMode="UTC" />
            </Interpretation>
          </TypeDescriptor>
          <TypeDescriptor TypeName="System.String" Name="Text" />
          <TypeDescriptor TypeName="BCSWebServiceProxy.ThirdClass, Sample-LobSystemUserNamePasswordFilter" Name="Third">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.DateTime" Name="Date">
                <Interpretation>
                  <NormalizeDateTime LobDateTimeMode="UTC" />
                </Interpretation>
              </TypeDescriptor>
              <TypeDescriptor TypeName="System.Int32" Name="Integer" />
            </TypeDescriptors>
          </TypeDescriptor>
          <TypeDescriptor TypeName="System.Boolean" Name="Gender" />
          <TypeDescriptor TypeName="System.Int32" Name="Integer" />
          <TypeDescriptor TypeName="System.String" Name="Name">
            <DefaultValues>
              <DefaultValue MethodInstanceName="FinderGenericMethod" Type="System.String">teest</DefaultValue>
            </DefaultValues>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
    <Parameter Direction="Return" Name="GenericMethod">
      <TypeDescriptor TypeName="BCSWebServiceProxy.RootComplexClass[], Sample-LobSystemUserNamePasswordFilter" IsCollection="true" Name="GenericMethod">
        <TypeDescriptors>
          <TypeDescriptor TypeName="BCSWebServiceProxy.RootComplexClass, Sample-LobSystemUserNamePasswordFilter" Name="GenericMethodElement">
            <TypeDescriptors>
              <TypeDescriptor TypeName="System.Boolean" Name="Gender" />
              <TypeDescriptor TypeName="System.Int32" ReadOnly="true" IdentifierName="Integer" Name="Integer" />
              <TypeDescriptor TypeName="System.String" ReadOnly="true" IdentifierName="Name" Name="Name" />
            </TypeDescriptors>
          </TypeDescriptor>
        </TypeDescriptors>
      </TypeDescriptor>
    </Parameter>
  </Parameters>
  <MethodInstances>
    <MethodInstance Type="Finder" ReturnParameterName="GenericMethod" Default="true" Name="FinderGenericMethod">
      <Properties>
        <Property Name="RootFinder" Type="System.String"></Property>
        <Property Name="UseClientCachingForSearch" Type="System.String"></Property>
      </Properties>
      <AccessControlList>
        <AccessControlEntry Principal="REDMOND\Domain Users">
          <Right BdcRight="Edit" />
          <Right BdcRight="Execute" />
          <Right BdcRight="SetPermissions" />
          <Right BdcRight="SelectableInClients" />
        </AccessControlEntry>
      </AccessControlList>
    </MethodInstance>
  </MethodInstances>
</Method>