how to pass SAML attributes from service provider(Salesforce) to Visualforce page Controller

馋奶兔 提交于 2021-02-10 20:20:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!