Skip to content

Ap 751:Update login link - #95

Open
yzhoubk wants to merge 4 commits into
mainfrom
AP-751
Open

Ap 751:Update login link#95
yzhoubk wants to merge 4 commits into
mainfrom
AP-751

Conversation

@yzhoubk

@yzhoubk yzhoubk commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fix sign-in/sign-out failures after migration:

  1. Replace the generic sign-in method with a user-scoped sign-in.
  2. Add/update Devise scope routes for sign-in/sign-out in routes.rb, including sign-in redirect to CalNet auth and sign-out through SessionsController.
  3. Config ominauth to allow GET for CalNet auth sign-in page.

@anarchivist anarchivist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have some concerns about the approach here. we should not be allowing GET requests against the omniauth calnet provider. we also seem to be diverging from the present approach in the release/1.x branch.

Comment on lines +2 to +3
# Allow GET as well so direct navigation to /users/auth/calnet works.
OmniAuth.config.allowed_request_methods = %i[get post]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we want or need this initializer. adding support for GET requests causes security concerns, which is why omniauth removed it as a default in version 2.

Comment thread config/routes.rb

devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' }
devise_scope :user do
get 'users/sign_in', to: redirect('/users/auth/calnet'), as: :new_user_session

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a users/sign_in route?

Comment on lines +26 to +32
def calnet_logout_url(return_url = root_url)
host = Devise.omniauth_configs[:calnet].options[:host]
path = Devise.omniauth_configs[:calnet].options[:logout_url]
URI::HTTPS.build(host:, path:, query: {
service: return_url
}.to_query).to_s
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we adding this method? it's not in the release/1.x branch - how was it being generated before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants