Skip to content

Commit

Permalink
Configure devise to use Azure OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
steventux authored and richardpattinson committed Jul 6, 2023
1 parent 30e0be3 commit bdd7981
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ BIGQUERY_API_JSON_KEY={ replaceMe: 'I should be a copy of a BigQuery JSON key' }
BIGQUERY_DATASET=events_local
BIGQUERY_PROJECT_ID=apply-for-qts-in-england
BIGQUERY_TABLE_NAME=events
MICROSOFT_OAUTH_CLIENT_ID=test
MICROSOFT_OAUTH_CLIENT_SECRET=test
4 changes: 3 additions & 1 deletion app/models/staff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class Staff < ApplicationRecord
:timeoutable,
:validatable,
:lockable,
:invitable
:invitable,
:omniauthable,
omniauth_providers: [:azure_activedirectory_v2]

self.timeout_in = 20.minutes

Expand Down
4 changes: 4 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@
# generated before the user's current sign in time to be expired. In other words,
# each time you sign in, all existing magic links will be considered invalid.
# config.passwordless_expire_old_tokens_on_sign_in = true

config.omniauth :azure_activedirectory_v2,
client_id: ENV["MICROSOFT_OAUTH_CLIENT_ID"],
client_secret: ENV["MICROSOFT_OAUTH_CLIENT_SECRET"]
end

# As we only use magic link authentication for teachers, we don't need to unnecessarily
Expand Down

0 comments on commit bdd7981

Please sign in to comment.