F5 Sites
  • F5.com
  • LearnF5
  • NGINX
  • MyF5
  • Partner Central
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
Groups
EventsSuggestionsHow Do I...?
RegisterSign In
  1. DevCentral
  2. Articles
  3. Technical Articles

Office 365 Logon Enhancement – Username Capture

Introduction With the new Office 365 sign-in experience you can capture the username entered at the O365 login page! This has been a frequent request from Office 365 users federated via SAML so us...
Published Aug 10, 2017
Version 1.0
BIG-IP Access Policy Manager (APM)
iRules
security
Graham_Alderso1's avatar
Graham_Alderso1
Ret. Employee
Joined May 22, 2019
View Profile
Graham_Alderso1's avatar
Graham_Alderso1
Ret. Employee
Joined May 22, 2019
View Profile
Gav_387282's avatar
Gav_387282
Icon for Nimbostratus rankNimbostratus
Mar 29, 2019

Great post!

Slight modification if being redirected from mail.office365.com. This will capture the username if found and write it to the session.logon.last.username only if the URI and referrer are matched. You can then use this in VPE as described above to pre-populate username

when HTTP_REQUEST {
 if { [HTTP::uri] starts_with "/adfs/ls/" } {
      if { [HTTP::header exists "Referer"] && [HTTP::header "Referer"] contains "office365.com" } {
           set received_requesturl [HTTP::uri]
           log local0. "Starting GetURIUsername"
           log local0. $received_requesturl
           if { $received_requesturl contains "username="} {
                log local0. "requested URL has username"
                set username [URI::decode [URI::query $received_requesturl username]]
                log local0. "Username detected as $username"
           }
           unset received_requesturl
       }
 }
 }

when ACCESS_SESSION_STARTED {
if { [ info exists username ] } {
    ACCESS::session data set session.logon.last.username $username
    log local0. "Username set to $username"
}
}

ABOUT DEVCENTRAL

DevCentral NewsTechnical ForumTechnical ArticlesTechnical CrowdSRCCommunity GuidelinesDevCentral EULAGet a Developer Lab LicenseBecome a DevCentral MVP

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesF5 CertificationLearnF5 Training

SUPPORT

Manage SubscriptionsProfessional ServicesProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

F5 logo©2024 F5, Inc. All rights reserved.
TrademarksPoliciesPrivacyCalifornia PrivacyDo Not Sell My Personal Information