Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add debug lines #661

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/auth/vault_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,31 @@ def login
end

def authenticate
Rails.logger.info "Using token #{vault_token}"

@current_user = User.find_by_token(vault_token)

if @current_user.nil?
Rails.logger.info 'User not found, attempting to log in'

user = User.find_or_create_by(name: username)

Rails.logger.info "#{username} created"

user.auth = 'vault'
user.token = vault_token
user.roles = []
user.save!
@current_user = user
end

# assign the real token for use
@current_user.token = vault_token if @current_user
if @current_user
# assign the real token for use
@current_user.token = vault_token

Rails.logger.info "User #{@current_user.name} assigned vault token"
end

@current_user
end

Expand Down