I want to set up a new Servlet which returns the current session expiration date (login-token cookie).
Is there a way to get it starting from a SlingHttpServletRequest ?
Also, is there a built-in endpoint that I can use instead? Using AEM 6.5
Thanks!
Related
I'm new to Data Factory and I need to pull data from a Rest API to SQL database. I can set this up with static URL, but the API URL needs the current date time and other criteria to be updated dynamically. For example, I have this API URL:
https://api.something.com/2021-03-23T00:00:00Z/
The "2021-03-23T00:00:00Z" should be changed dynamically for the current datetime every time it's triggered. I'm not sure how to set this up. Please help!
I think you can add dynamic content #concat('https://api.something.com/',formatDateTime(utcnow(),'yyyy-MM-ddTHH:mm:ss'),'Z') to the URL tab.
The output is as follows:
I am using Magento version 1.9.1.0 and trying to use Magento Rest APIs using OAuth Integration.
I have consumer key and consumer secret. Now want to get OAuth token for Rest APIs usage.
I have followed http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html
In this , we needed oauth_signature and timestamp which we doesn't get when we create consumer on admin panel . Now how can we get OAuth token with only consumer key and consumer secret ?
I think you should follow Inchoo blog http://inchoo.net/magento/consuming-magento-rest-zend_oauth_consumer/. Hope you will get some idea.
The following parameters are required to oauth initiate process :
realm="",
oauth_version="1.0",//oauth version
oauth_signature_method="PLAINTEXT",
oauth_nonce="oklThLFvQkxNUpf",//a random unique value
oauth_timestamp="1426745444", //current time stamp
oauth_consumer_key="37d05fa37aea5513d4cda24c0b1f3e00",//get from admin 'key'
oauth_signature="a183969724b3068b7b0d70e7ce9d0f09%26",//a random unique string
oauth_callback="http%3A%2F%2Flocalhost%3A8888" // your call back method
The initiate url will be like => http://yourdomain/oauth/initiate
I also attached two snap for your help.
please check that .htaccess file rewrite
RewriteRule ^api/rest api.php?type=rest [QSA,L]
takes effect.
Check you use Apache (not nginx or other Webserver that doesn't support .htaccess)
I just discovered that when I configure the session plugin of a Catalyst app (Catalyst::Plugin::Session) to expire, it screws with the flash data. More specifically, I'm finding that flash data no longer carries over with a new request.
Does this sound normal? How might I cope with this?
Perfectly normal. The whole point of sessions is to be able to associated data from one request with data in another request. When you let the session for some request expire, you are saying that that request's data shouldn't have anything to do with any future request.
More specifically, the flash data is a part of the session data -- see the _save_flash method in the Catalyst/Plugin/Session.pm file, for instance. Also see the big warning for the delete_session method:
NOTE: This method will also delete your flash data.
How to cope with it? You need to persist data from a request using any scheme other than the Session plugin. Without knowing more about your app, what data you are trying to persist, and how you will associate data from an old session with a new request, I couldn't begin to make a more specific recommendation than that.
When configuring the session for example with a database backend you'll have to add flash_to_stash as an option:
<session>
dbi_dbh DB
dbi_table sessions
dbi_id_field id
dbi_data_field session_data
dbi_expires_field expires
flash_to_stash 1
expires 3600
</session>
I am using CGI::Session for session management in my Perl web application. I am able to
create a session using the file session driver but I am unable to get the existing session and unable to access stored parameters of session.
I am trying to get existing session but it's creating new one
and query string $CGISESSID both are same but $session here I am getting was different
it's a totally new one so I am unable to get the stored parameters from session.
Please help me to resolve this issue.
Thanks,
Krishna
If you are getting new session at each request, as others pointed out, you are not sending session id in the cookie. If you are using CGI.pm to handle your HTTP header, do this:
print $q->header(-cookie => $session->cookie);
If you are using CGI::Application for your Application framework, do this inside the setup() or cgiapp_init() (if you have it)
$self->header_add(-cookie => $session->cookie);
Or, you can use CGI::Session's own header(), which by default, uses' CGI::header method:
print $session->header()
Using CGI::Session's utilities (such as cookie and/or header) are recommended since they honor expiration settings for the cookie.
Are you doing
print $session->header()
before printing the html content?
I use Zend_Session::rememberMe(60*60*24*90); to make the session of a logged-in user to last for 90 days.
I've read the Zend_Session documentation but didn't find any method to check that this expiration is actually set somewhere.
I cannot check the browser cookie, at least directly, as the webpage is embedded within an Adobe Air widget.
If you just want it for debugging purpose use:
var_dump($_SESSION['__ZF']);
you can see all of the values stored in zend session including rememberme 's expiration.