Skip to content

Commit 9f486e5

Browse files
committed
Authorize requests to courses.mooc.fi
1 parent 0794e94 commit 9f486e5

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

app/models/user.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,14 @@ def authenticate_via_courses_mooc_fi(courses_mooc_fi_user_id, submitted_password
156156
auth_url = SiteSetting.value('courses_mooc_fi_auth_url')
157157
response = RestClient.post(
158158
auth_url,
159-
{ user_id: courses_mooc_fi_user_id, password: submitted_password }.to_json,
160-
{ content_type: :json, accept: :json }
159+
{
160+
user_id: courses_mooc_fi_user_id,
161+
password: submitted_password }.to_json,
162+
{
163+
content_type: :json,
164+
accept: :json,
165+
Authorization: Rails.application.secrets.tmc_server_secret_for_communicating_to_secret_project,
166+
}
161167
)
162168

163169
data = JSON.parse(response.body)
@@ -184,9 +190,13 @@ def update_password_via_courses_mooc_fi(courses_mooc_fi_user_id, old_password, n
184190
{
185191
user_id: courses_mooc_fi_user_id,
186192
old_password: old_password,
187-
new_password: new_password
193+
new_password: new_password,
188194
}.to_json,
189-
{ content_type: :json, accept: :json }
195+
{
196+
content_type: :json,
197+
accept: :json,
198+
Authorization: Rails.application.secrets.tmc_server_secret_for_communicating_to_secret_project,
199+
}
190200
)
191201

192202
data = JSON.parse(response.body)

0 commit comments

Comments
 (0)