code/authenticators/SAMLLoginForm.php
protected function getMessageFromSession()
    {
        // The "MemberLoginForm.force_message session" is set in Security#permissionFailure()
        // and displays messages like "You don't have access to this page"
        // if force isn't set, it will just display "You're logged in as {name}"
        if (($member = Member::currentUser()) && !Session::get('MemberLoginForm.force_message')) {
            $this->message = _t(
                'Member.LOGGEDINAS',
                "You're logged in as {name}.",
                ['name' => $member->{$this->loggedInAsField}]
            );
        }
        Session::set('MemberLoginForm.force_message', false);
        parent::getMessageFromSession();
        return $this->message;
    }
protected function getMessageFromSession()
    {
        // The "MemberLoginForm.force_message session" is set in Security#permissionFailure()
        // and displays messages like "You don't have access to this page"
        // if force isn't set, it will just display "You're logged in as {name}"
        if (($member = Member::currentUser()) && !Session::get('MemberLoginForm.force_message')) {
            $this->message = _t(
                'Member.LOGGEDINAS',
                "You're logged in as {name}.",
                ['name' => $member->{$this->loggedInAsField}]
            );
        }
        Session::set('MemberLoginForm.force_message', false);
        parent::getMessageFromSession();
        return $this->message;
    }
Get message from session