Condividi tramite


XML Snippet: Use Username and Password Filters in a BDC Model

Applies to: SharePoint Server 2010

The following is an example of a username and password filter in a BDC model.

Example

The username and password filter requires the configuration of the Secure Store properties as shown.

<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>

The following is the definition of a username and password filter.

<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>