function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NaradorNarador 

Can you enable SSO with a Post Copy Apex class?

As part of a citizen development project I'm working on, there is a new to automatically provision sandboxes to non admins giving them sys admin in that environment. I'm looking to create a post copy apex class that can do the following things:
  1. Enable Single Sign On
  2. Enable an Authentication Service in My Domain
  3. Change a user's Profile
  4. Change a user's email without requiring verification from the new address
  5. Send an email to that user
Is this possible, and if so does anyone have any classes I can reuse or tailor to my needs? Thanks!
ShirishaShirisha (Salesforce Developers) 
Hi Narador,

Greetings!

I don't think enabling the SSO is possible by Post Copy Apex class as whenever you create the Sandbox then it will copy the Production data which includes the SSO configuration as well.

Also,whenever you change the email address of an existing user then an email should send to the user for verification unless they unsubscribe to the salesforce emails.

And,yes we should be able to change the profile of the users by querying and updating with the new profiles with apex code.

Please refer the sample code which you can use it in your Post apex class:

https://developer.salesforce.com/forums/?id=9060G000000I6fTQAS

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
NaradorNarador
I have SSO enabled already in production but whenever I refresh, SAML is disabled. I should have been more specific that this is what I wanted to change from False to True. See below:
SAML Enabled checkbox
Then I want to enable an Authentication Service as seen below. When refreshing, the 4th option down is NOT checked. I want to have it checked automatically after refresh:
Authentication Services

When changing an email there is a link sent to the new email address for verification. Is there a way to bypass that for just for sandbox environments?

Changing profile seems quite simple. Thanks for the info! Let me know on the above.
Suraj Tripathi 47Suraj Tripathi 47
Hi Narador ,

 Step01:First use  Apache HTTPD as a web proxy for APEX in your org. 
 
 Step02:and after that Install and configure the mod_auth_mellon module for the web server.
 
 step03:After that do Set up the application on the identity management system of choice.

 Step04:now For the APEX application and use the http header Auth Scheme. then after that The HTTP Header variable should have been configured automatically
 when mod_auth_mellon was installed and set up.

   
 If you find your Solution then mark this as the best answer.

 

  Thank you!


  Regards,

  Suraj Tripathi 
Leslie GarciaLeslie Garcia
Thanks for the information, I will try to figure it out for more. Keep sharing such informative post.

skylightpaycard (https://www.skylightpaycard.online/)
Thai Ha ClinicThai Ha Clinic
Thanks you! Welcome Thai Ha Clinic is a prestigious medical examination and treatment address in Hanoi, Vietnam.
https://phongkham.edu.vn/
https://thaihaclinic.webflow.io/
https://www.phs.moh.gov.cy/web/thaihaclinic