• Xavier Mamet
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi all,

I would like to implement the following functionnality.

Users are working in Salesforce, and at some point they need to authenticate again to access some restricted features. Let's say I have a VF page, I click on a button which is going to update some objects ONLY if my credentials are valid.

For that purpose I would like to use SAML protocol in order to send an AuthnRequest to ADFS. Depending on the response sent back by ADFS, users are allowed to go ahead with the button (for instance).

I have started to write an Apex method to perform an HTTP callout to ADFS, and it seems to work (I assume that my AuthnRequest is well formatted - online saml parser told me so - and the response code = 200).

But I am stuck at this point. I do not know how to go further. Should I write another apex class to create an endpoint so that ADFS sends the response to it? How the response is related to the initial request?

My problem is that I can find lots and lots of resources about how to configure SAML for SSO, but in fact I want to implement SAML requests/responses for NOT SSO!
Anyone has some resources to share on this topic?

Thanks

Xavier
Hi Everyone,

Can anyone help me in test class.
I have an error in test method assert .

User-added image
Test class :
 
@isTest
public class TwnxTest {

    //this method for testing with names as "Twilio"
    public static testmethod void testSmsFromTwnxWithNameAsTwilio(){        
        
        Contact con = new Contact(LastName='test',Phone='+19343213321');
        insert con;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(con);
        
        Twnx twInstance = new Twnx(sc);
        
        configuration_setting__c configSettings= new configuration_setting__c();
        configSettings.Name='Twilio';
        configSettings.AccountSid__c = 'accountId';
        configSettings.Active__c = true;
        configSettings.AuthToken__c ='auth002';
        configSettings.Bulk_SMS__c='+18559331384';
        configSettings.Contact_Phone_Number__c='+18559172384';
        configSettings.Lead_Phone_Number__c='+14154633840';        
        insert configSettings;
        
        Test.setMock(HttpCalloutMock.class, new Twilio_MockClass());
        
        
        System.Test.startTest();
        
        Twilio.sendfromtwilio(configSettings.Contact_Phone_Number__c,'test',con.Phone);
        twInstance.sendfromtwnx();
        twInstance.ok();
        
        System.Test.stopTest();
    }
    
    //this method for testing with names as "Nexmo"
    public static testmethod void testSmsFromTwnxWithNameAsNexmo(){        
        
        Contact con = new Contact(LastName='test',Phone='+19343213321');
        insert con;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(con);
        
        Twnx twInstance = new Twnx(sc);
        
        configuration_setting__c configSettings= new configuration_setting__c();
        configSettings.Name='Nexmo';
        configSettings.AccountSid__c = 'accountId';
        configSettings.Active__c = true;
        configSettings.AuthToken__c ='auth002';
        configSettings.Bulk_SMS__c='+18559331384';
        configSettings.Contact_Phone_Number__c='+18559172384';
        configSettings.Lead_Phone_Number__c='+14154633840';      
        insert configSettings; 
        
       	Test.setMock(HttpCalloutMock.class, new Nexmo_MockClass());
        
        
        System.Test.startTest();
        
        Nexmo.sendMessage( con.Phone,  configSettings.Contact_Phone_Number__c,  'text',  'sms');
        twInstance.sendfromtwnx();
        twInstance.ok();
        
        System.Test.stopTest();
    }
}

 
  • February 28, 2020
  • Like
  • 0
I'm trying to come up with a SOQL query that displays the following:


Account Name | Opportunity Closed Date (most recent, won) | Product Purchased | Opportunity Amount

So far I've only been able to get as far as this:
 
SELECT Account.Name, CloseDate, Amount, (SELECT Product2.Name FROM OpportunityLineItems) FROM Opportunity WHERE IsClosed = true AND StageName = 'Closed Won'

 


If this is not possible with SOQL, is it possible with Salesforce Reports? Thank you!