I have an ASP.NET Core app, and I am trying to set up a SAML 2.0 login system.
When I connect to the IdP, I get this object back:
saml2AuthnResponse.ClaimsIdentity.Claims;
And when I look through it, I see this:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier: AAdzZWNyZXQxO1n4bE5XWDad/3XvgMDg9TRA8wIG9saVhmfGWFNpbu28iA/ts/EfK7S+XB9oNoOe6pBmGA8zZkOWTmZpQ9amrRjCto1MFw2/MlBF10geQZwqxv+d2f2+lz/fIoqx9DE=
workflowid: 05
urn:oid:1.3.6.1.4.1.5923.1.1.1.6: [email protected]
What I need is the email part, [email protected]
How do I get that part though?
I know I can write it out as I did, but I just need the email, not the whole part that starts with urn:oid...
Is there a way to capture that?
Thanks!
Try "tokenizing".
string s = "urn:oid:1.3.6.1.4.1.5923.1.1.1.6: [email protected]";
string email = s.Split( new char[] { ' ' } ).Last();
Debug.Assert( email.Contains( "@" ) );
Console.WriteLine( email );
Console.ReadKey();