Forum Discussion
irule to decode using base64
Hi All,
Need help in irule. Currently using the below irule to capture username and password which is in plain text. The username/password is sent as query string in uri and this is working fine for me.
Query sent is like this : https://tryloginsso.help.com.ca?username=67580&password=login@123
Current irule is as below:
when ACCESS_SESSION_STARTED {
set username [URI::query [HTTP::uri] "username"]
set password [URI::query [HTTP::uri] "password"]
ACCESS::session data set session.logon.last.username $username
ACCESS::session data set session.logon.last.password $password
log local0. "vvvvv $username"
log local0. "vvvvv $password"
log local0. session.logon.last.usernam
}
As credentials sent is in plain text and concern about security. Query string is encoded using base64 as below from code. I want to write irule to decode the query string using base64 pass it for authentication.
var useridBytes = Encoding.UTF8.GetBytes(userId);
string userId_Encoded = Convert.ToBase64String(useridBytes);
var pwdBytes = Encoding.UTF8.GetBytes(pwd);
string pwd_Encoded = Convert.ToBase64String(pwdBytes);
Let me know what irule can be written to achieve this. Thanks in advance.
- Stanislas_Piro2
Cumulonimbus
Hi,
to decode base64, use the command:
set userId_Encoded [b64decode $userId]
Recent Discussions
Related Content
* 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