Forum Discussion
Edouard_Zorrill
Nimbostratus
Nov 15, 2016APM Authentication by using cookies
Hi Guys, I need to make APM pass along the username via encrypted cookie. Please let me know if you can advise a documentation to accomplish that.
Thanks, Edouard.
1 Reply
- Stanislas_Piro2
Cumulonimbus
Hi,
you can use this irule (not tested)
when RULE_INIT { to be changed prior to any publishing set static::passphrase "hEuoYjmFUpB4PcpO3bUdQtLP4ic7jjm" } when ACCESS_SESSION_STARTED { if { [HTTP::cookie exists APMAuth] } { set decrypted [HTTP::cookie decrypt "APMAuth" $static::passphrase] scan $decrypted {%[^:]:%s} username password ACCESS::session data set session.logon.last.username $username ACCESS::session data set -secure session.logon.last.password $password } } when ACCESS_POLICY_COMPLETED { if { ([ACCESS::policy result] equals "allow") } { HTTP::cookie encrypt "TMPCOOKIE" "[ACCESS::session data get session.logon.last.username]:[ACCESS::session data get -secure session.logon.last.password]" HTTP::cookie encrypt "TMPCOOKIE" $static::passphrase ACCESS::respond 302 noserver "Location" [ACCESS::session data get session.server.landinguri] "Cache-Control" "no-cache, must-revalidate" Set-Cookie "APMAuth=[HTTP::cookie TMPCOOKIE];path=/" } }and configure VPE to check if session.logon.last.username is not null.
if session.logon.last.username equals "" then prompt for logon page, else validate authentication with user / password stored in encrypted cookie.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects