• Brice Mbouani 9
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
Hi guys,

I've a very weird behavior right there.

The lightning component is basically a div with a background image using inline CSS  (as the dynamic image URL is fectched from database using soql) :
 
<div class="sc-card__image-container" style="{! 'background: linear-gradient(to bottom, transparent, #000000b8), url(' + v.thumbnail + ') no-repeat center;background-size: cover'}"> 
... </div>

When i test from Salesforce Desktop or & Mobile device simulator using Chrome, the lightning component is perfectly showing from.

But from Salesforce1 app on Android,  the background image does not show at all...
Do you have any idea what's wrong? Does it come from using inline CSS? If yes, how could i do this in a proper way?
​​​​​​​
Thank you

 
I'm struggling to build a signed URL to access S3 object from CloudFront. When i test my signed url i've an access denied error message from AWS :
 
<Error>
     <Code>AccessDenied</Code>
     <Message>Access denied</Message>
    </Error>



I've (normally) followed all the steps provided by Amazon (https://docs.aws.amazon.com/fr_fr/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html) to configure a distribution and build a signed url :

 - I've created a cdn distribution
 - Configure an origin access identity (OAI) for this distribution
 - This OAI is configured to access my S3 object
 - Users can access my S3 objects only by using cloudfront URL.

Below is my S3 bucket policy :

 
{
    "Version": "2008-10-17",
    "Id": "PolicyForCloudFrontPrivateContent",
    "Statement": [
        {
            "Sid": "2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity myawesomeOAI"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::myawesomebucket/*"
        }
    ]
   }

And of course my apex code :  
public class cloudFrontContentUriBuilder {
        final static String cloudFrontHost = 'myawesomecloudfront.cloudfront.net';
        final static String cloudFrontKeyPairId = 'cdnkeypairid';
        
        public static String getSignURL() {
            Blob privateKey = cfPrivateKey();
            String policy = cfPolicy('http://' + cloudFrontHost + '/' + s3ObjectEndpoint, expiry);            ResponseData responseData = new ResponseData();
            
            s3ObjectEndpoint = 'imageL.png';
            String method = 'GET';
                       
            try{
                Blob mac = Crypto.Sign(
                    'RSA-SHA1',
                    Blob.valueOf(rPolicy),
                    privateKey
                );
        
                String signature = cfReplace(EncodingUtil.base64Encode(mac));
        
                String u  = 'http://' + cloudFrontHost + '/' + s3ObjectEndpoint + '?Policy=' +
                    policyEnc + '&Signature=' + signature + '&Key-Pair-Id=' +
                    cloudFrontKeyPairId;
        
                Map<String, String> r = new Map<String, String>();
        
                r.put('url', u);
                responseData.results = r;    
                
            } catch (Exception e) {
                responseData.addError(e.getMessage());
            }

            return responseData.getJsonString();
        }
        

    }

Do you guys think i'm using the right way to build my signature?

Thanks a lot for your help! I've been spending days on this !
Hi guys,

I've a very weird behavior right there.

The lightning component is basically a div with a background image using inline CSS  (as the dynamic image URL is fectched from database using soql) :
 
<div class="sc-card__image-container" style="{! 'background: linear-gradient(to bottom, transparent, #000000b8), url(' + v.thumbnail + ') no-repeat center;background-size: cover'}"> 
... </div>

When i test from Salesforce Desktop or & Mobile device simulator using Chrome, the lightning component is perfectly showing from.

But from Salesforce1 app on Android,  the background image does not show at all...
Do you have any idea what's wrong? Does it come from using inline CSS? If yes, how could i do this in a proper way?
​​​​​​​
Thank you

 
I'm struggling to build a signed URL to access S3 object from CloudFront. When i test my signed url i've an access denied error message from AWS :
 
<Error>
     <Code>AccessDenied</Code>
     <Message>Access denied</Message>
    </Error>



I've (normally) followed all the steps provided by Amazon (https://docs.aws.amazon.com/fr_fr/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html) to configure a distribution and build a signed url :

 - I've created a cdn distribution
 - Configure an origin access identity (OAI) for this distribution
 - This OAI is configured to access my S3 object
 - Users can access my S3 objects only by using cloudfront URL.

Below is my S3 bucket policy :

 
{
    "Version": "2008-10-17",
    "Id": "PolicyForCloudFrontPrivateContent",
    "Statement": [
        {
            "Sid": "2",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity myawesomeOAI"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::myawesomebucket/*"
        }
    ]
   }

And of course my apex code :  
public class cloudFrontContentUriBuilder {
        final static String cloudFrontHost = 'myawesomecloudfront.cloudfront.net';
        final static String cloudFrontKeyPairId = 'cdnkeypairid';
        
        public static String getSignURL() {
            Blob privateKey = cfPrivateKey();
            String policy = cfPolicy('http://' + cloudFrontHost + '/' + s3ObjectEndpoint, expiry);            ResponseData responseData = new ResponseData();
            
            s3ObjectEndpoint = 'imageL.png';
            String method = 'GET';
                       
            try{
                Blob mac = Crypto.Sign(
                    'RSA-SHA1',
                    Blob.valueOf(rPolicy),
                    privateKey
                );
        
                String signature = cfReplace(EncodingUtil.base64Encode(mac));
        
                String u  = 'http://' + cloudFrontHost + '/' + s3ObjectEndpoint + '?Policy=' +
                    policyEnc + '&Signature=' + signature + '&Key-Pair-Id=' +
                    cloudFrontKeyPairId;
        
                Map<String, String> r = new Map<String, String>();
        
                r.put('url', u);
                responseData.results = r;    
                
            } catch (Exception e) {
                responseData.addError(e.getMessage());
            }

            return responseData.getJsonString();
        }
        

    }

Do you guys think i'm using the right way to build my signature?

Thanks a lot for your help! I've been spending days on this !
Hi All, 

Im trying to do the second challenge in App Customization  but am getting some Super badge am getting the error "Challenge Not yet complete... here's what's wrong:  Couldn’t find the 'Volunteer Shift' relationship field or it is not configured correctly."
Please, anyone, can anyone tell me which relationships should be created between these objects? I have created a master-detail relationship between them. 
User-added image

Also, am not clear with this "Shifts with cascading delete and the option of roll-up summary fields." 

Thank you and any help is appreciated.
Thank you in advance. 
I am trying to generate AWS Cloudfront singed url using apex but every time get Access Denied.

public url is working fine. i.e. jueh890044563.cloudfront.net/test.pdf

But I need a singed url of cloudfront.

I have already done following things in AWS.

S3 bucket is private.
test.pdf is private.
Created cloudfront Distribution (domain name is : jueh890044563.cloudfront.net)

Apex code

String keyPairId = 'YTEHJLKFHHRKF';
Datetime now = DateTime.now();
Datetime expireson = now.addDays(2);
Long Lexpires = expireson.getTime()/1000;

String policyStatement = '{"Statement":[{"Resource":"jueh890044563.cloudfront.net/test.pdf","Condition":{"DateLessThan":{"AWS:EpochTime":'+Lexpires+'}}}]}';

policyStatement = EncodingUtil.base64Encode(Blob.valueOf(policyStatement));

String privateKey = 'dfgdfgtgdfgdfgdfsgdfgdfsgdfgdfgdfgsdf'+
'dfgdfgdfgdfgdfgdfgdfgdfgdfgfgdfgdfsdf'+
'dfdfgdfgdfgdfgdfgfdgdfg/i0AB1Jz20QlGy'+
'dsfgdfgdfgdfgdfgdfgdsfgdfgdfgffdfgdfg';

Blob mac = Crypto.generateMac('HmacSHA1', blob.valueof(policyStatement),blob.valueof(privateKey));
String signed = EncodingUtil.base64Encode(mac);

String downloadUrl = 'jueh890044563.cloudfront.net/test.pdf?Policy='+policyStatement+'&Signature='+signed+'&Key-Pair-Id='+keyPairId;

Is downloadUrl is singedUrl? When we run this url then return Access Denied.

Thanks in advance.
Hi guys,

Need your help to know how to import the files into salesforce, thanks
The first picture is structure of the files:
User-added image
The second picture is what the files is

User-added image