1

requirement- When user enter username then it will redirect to SSO setup in salesforce and if user entered correct details then second sso needs to get called and if user enter correct credentials then it allows to in into salesforce

Here in below code i am able to call one sso but after this how can i call second sso to validate. Please suggest

public with sharing class MyDomainDiscLoginDefaultHandler implements Auth.MyDomainLoginDiscoveryHandler {
public PageReference login(String identifier, String startUrl, Map<String, String> requestAttributes) {

ttps://cdsd.my.salesforce.com'), startUrl, SSO.Id); if(ssoUrl!=null || ssoUrl!='') { return new PageReference(ssoUrl); } return null; }

private PageReference discoveryResult(User user, String startUrl, Map<String, String> requestAttributes) {
    PageReference ssoRedirect = getSsoRedirect(user, startUrl, requestAttributes);
    if (ssoRedirect != null) {
        System.debug('Inside SSO####');
        return ssoRedirect;
    } 
    else {  
0

My Domain login discovery is a flow of control component that routes the user to the appropriate authentication service/mechanism based on provided identifier. For example, if an email address is an identifier and your discovery rule is 'all corporate users have email addresses that end with @blah.com and shall authenticate via username/password', then your code implementing Auth.LoginDiscoveryHandler interface will do just that. The PageReference that would be returned by the login(...) method in this example is the URL of the Salesforce login page with username/password as the authentication method. The actual authentication step (validation of username/password) is not in scope of LoginDiscoveryHandler.

Now let's modify the discovery rule so it reads 'all corporate users have email addresses that end with @blah.com and shall authenticate via SAML with Google as the identity provider'. Implementing this discovery rule will trigger a single sign-on sequence and sign the user into Salesforce as long as they're already authenticated by Google. In this case you want to have your code return a PageReference with a URL that will initiate said sequence. The URL in question depends on your identity provider, the particular SSO protocol you want to use and the flows allowed by this protocol. Similar to the username/password example above, the SSO negotiation and authentication step within SSO is not in scope of LoginDiscoveryHandler.

| improve this answer | |
  • Question remains same.I need to allow user to be login if he is able to provide correct authentication in 2 sso flow,Suppose first one rsa token and second username/password.How can i achieve this – sudhanshu May 22 '19 at 9:53
  • That would be 2-factor authentication. Please post a new question and describe what you're trying to achieve (meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – identigral May 22 '19 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.