问题
SAML response from the identity provides(External) contains the Employee Id as a separate attribute which i need to display in Salesforce VisualForce Page. So help me in passing the attributes from saml response to a VF Page once authenticated via SSO .
Thanks in advance
回答1:
Do you have a custom SAML handler class? You can generate a template one in SSO settings (bottom of the form, in JIT section) or just look around in documentation. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_Auth_SamlJitHandler.htm or https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_auth_plugin.htm. They both include a Map<String,String>
to which all attributes from the SAML assertion should be passed.
Once you have them in your code... Not sure if you can do a redirect straight from there but shouldn't be hard to save the attribute in a field on User or wherever you need really. And then query & display it in VF?
If you don't have a custom handler and just use SF built-in piece... If the parameter has right name there's a chance SF will save it for you. You'll have to look at https://help.salesforce.com/articleView?id=000329069&type=1&mode=1. if your param is in format User.EmployeeNumber
(or custom field if you need one) - there's hope. If not - probably easiest is to use custom handler.
来源:https://stackoverflow.com/questions/58952758/how-to-pass-saml-attributes-from-service-providersalesforce-to-visualforce-pag