locked
how to access Saml2Constants.ConfirmationMethods.Bearer property using System.IdentityModel RRS feed

  • Question

  • I am in process of upgrading my existing Microsoft.IdentityModel(WIF3.5)  based SSO block to System.IdentityModel (.Net 4.5).

    Does any one know how to access Saml2Constants.ConfirmationMethods.Bearer property using System.IdentityModel.Token ? In older implementation( Microsoft.IdentityModel) implementation the access modifier of Saml2Constants was public static where as in newer System.IdentityModel way Microsoft made Saml2Constants  class as internal static.

    Here is a small code snippet I was trying to upgrade where in the  last line I am getting a compile tme error for Saml2Constants.ConfirmationMethods.Bearer due to it’s internal access modifier.

      private Saml2Subject CreateSubject(string recipient, DateTime expirationTime, string nameId = "", string nameValue ="") 
            { 
                var subject = new Saml2Subject(); 
                var subjectConfData = new Saml2SubjectConfirmationData(); 
                subjectConfData.Recipient = new Uri(recipient); 
                subjectConfData.NotOnOrAfter = expirationTime; 
                subject.SubjectConfirmations.Add(new Saml2SubjectConfirmation(Saml2Constants.ConfirmationMethods.Bearer, subjectConfData));
    

    Is there any alternative to it ?


    Lingaraj Mishra

    Wednesday, October 25, 2017 9:13 AM

All replies

  • Hi Lingaraj Mishra,

    Thank you for posting here.

    When migrating from WIF3.5 to .NET4.5, some of the namespace has been removed.

    Based on my search, I do not find Saml2Constants.ConfirmationMethods.Bearer field. According to the old MSDN article, the field is more related to Assertion, you could try to use Saml2Assertion instead.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 26, 2017 8:34 AM
  • Thanks Anyway. In one of Microsoft Reference document show internal static class Saml2Constantshttp://referencesource.microsoft.com/#System.IdentityModel/System/IdentityModel/Tokens/Saml2Constants.cs,5d679b8003a55d18,references

    which is not accessible due to it's access modifier.


    Lingaraj Mishra

    Thursday, October 26, 2017 10:12 AM
  • Hi Lingaraj Mishra,

    The internal modifier could be access in the same assembly. Where do you want to use this?

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 2, 2017 2:29 AM
  •      
    Wednesday, November 8, 2017 2:09 AM
  • Hi Lingaraj Mishra,

    Any update for your question?

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 8, 2017 2:11 AM