共用方式為


Writing a Custom Claims Provider for SharePoint 2010 - Part 4: Supporting Resolve Name

In the first three parts of this series we've implemented just about all of the support needed to do an end-to-end claims provider. In this last post I'll describe how to name resolution support in the type-in control. To add this support we'll need to implement the following property and methods: SupportsResolve and FillResolve. Now the good news is that I already covered how to implement SupportsResolve and one of the FillResolve overloads in part 3. So this posting will be pretty short - here's the implementation for the other overload of FillResolve that was not covered in part 3:

protected override void FillResolve(Uri context, string[] entityTypes,

      string resolveInput,

      List<Microsoft.SharePoint.WebControls.PickerEntity> resolved)

{

 

//make sure picker is asking for the type of entity we

//return; site collection admin won't for example

if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))

      return;

 

//same sort of code as in search to validate we have a match

foreach (string team in ourTeams)

{

      if (team.ToLower() == resolveInput.ToLower())

      {

      //we have a match, create a matching entity

      PickerEntity pe = GetPickerEntity(team);

 

      //add it to the return list of picker entries

      resolved.Add(pe);

       }

}

}

 

If you've been following along then this chunk of code should be completely straightforward. If it isn't, then read through part 3 again.

We are now code complete. If I bring up the type-in control and enter a team name and then click the resolve button, here's what it looks like - first when you type it in, and then after clicking the resolve button:

And with that, we're done. Hopefully you will find this information useful as you start building out your claims authentication plans.

Comments

  • Anonymous
    January 01, 2003
    thanks

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    June 01, 2010
    Hi I read much of your blog and this special article is so cool. I create custom claim provider and register it as STS provider but wish you write how can login with a claim identity in low level mode without ADFS, i mean what is they way to set a custom Identity as current identity?

  • Anonymous
    September 18, 2014
    The comment has been removed