You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: session.rb
    path of file: ./repos/foreman/app/controllers/concerns/foreman/controller
    
    the code of the file until where you have to start completion: module Foreman::Controller::Session
  extend ActiveSupport::Concern

  def session_expiry
    return if ignore_api_request?
    if session[:expires_at].blank? || (Time.at(session[:expires_at]).utc - Time.n
    
  def expire_session
    logger.info "Session for #{User.current} is expired."
    backup_session_content { reset_session }
    if api_request?
      render :plain => '', :status => :unauthorized
    else
      sso = get_sso_method
      if sso.nil? || !sso.support_expiration?
        inline_warning _("Your session has expired, please login again")
        redirect_to main_app.login_users_path
      else
        redirect_to sso.expiration_url
      end