masq2 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +83 -0
  4. data/CODE_OF_CONDUCT.md +135 -0
  5. data/CONTRIBUTING.md +151 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +426 -0
  8. data/SECURITY.md +23 -0
  9. data/app/assets/images/masq/favicon.ico +0 -0
  10. data/app/assets/images/masq/openid_symbol.png +0 -0
  11. data/app/assets/images/masq/seatbelt_icon.png +0 -0
  12. data/app/assets/images/masq/seatbelt_icon_gray.png +0 -0
  13. data/app/assets/images/masq/seatbelt_icon_high.png +0 -0
  14. data/app/assets/stylesheets/masq/application.css.erb +61 -0
  15. data/app/controllers/masq/accounts_controller.rb +132 -0
  16. data/app/controllers/masq/base_controller.rb +78 -0
  17. data/app/controllers/masq/consumer_controller.rb +144 -0
  18. data/app/controllers/masq/info_controller.rb +23 -0
  19. data/app/controllers/masq/passwords_controller.rb +42 -0
  20. data/app/controllers/masq/personas_controller.rb +75 -0
  21. data/app/controllers/masq/server_controller.rb +247 -0
  22. data/app/controllers/masq/sessions_controller.rb +58 -0
  23. data/app/controllers/masq/sites_controller.rb +60 -0
  24. data/app/controllers/masq/yubikey_associations_controller.rb +25 -0
  25. data/app/helpers/masq/application_helper.rb +57 -0
  26. data/app/helpers/masq/personas_helper.rb +15 -0
  27. data/app/helpers/masq/server_helper.rb +15 -0
  28. data/app/mailers/masq/account_mailer.rb +17 -0
  29. data/app/models/masq/account.rb +245 -0
  30. data/app/models/masq/open_id_request.rb +42 -0
  31. data/app/models/masq/persona.rb +61 -0
  32. data/app/models/masq/release_policy.rb +11 -0
  33. data/app/models/masq/site.rb +68 -0
  34. data/app/views/layouts/masq/base.html.erb +70 -0
  35. data/app/views/layouts/masq/consumer.html.erb +30 -0
  36. data/app/views/masq/account_mailer/forgot_password.html.erb +3 -0
  37. data/app/views/masq/account_mailer/forgot_password.text.erb +3 -0
  38. data/app/views/masq/account_mailer/signup_notification.html.erb +5 -0
  39. data/app/views/masq/account_mailer/signup_notification.text.erb +5 -0
  40. data/app/views/masq/accounts/_hcard.html.erb +29 -0
  41. data/app/views/masq/accounts/edit.html.erb +100 -0
  42. data/app/views/masq/accounts/new.html.erb +27 -0
  43. data/app/views/masq/accounts/show.html.erb +4 -0
  44. data/app/views/masq/accounts/show.xrds.builder +40 -0
  45. data/app/views/masq/consumer/index.html.erb +31 -0
  46. data/app/views/masq/consumer/start.html.erb +2 -0
  47. data/app/views/masq/info/help.html.erb +8 -0
  48. data/app/views/masq/info/index.html.erb +5 -0
  49. data/app/views/masq/info/safe_login.html.erb +24 -0
  50. data/app/views/masq/passwords/edit.html.erb +13 -0
  51. data/app/views/masq/passwords/new.html.erb +11 -0
  52. data/app/views/masq/personas/_form.html.erb +159 -0
  53. data/app/views/masq/personas/edit.html.erb +9 -0
  54. data/app/views/masq/personas/index.html.erb +17 -0
  55. data/app/views/masq/personas/new.html.erb +9 -0
  56. data/app/views/masq/server/decide.html.erb +146 -0
  57. data/app/views/masq/server/index.xrds.builder +19 -0
  58. data/app/views/masq/server/seatbelt_config.xml.builder +24 -0
  59. data/app/views/masq/server/seatbelt_login_state.xml.builder +4 -0
  60. data/app/views/masq/sessions/new.html.erb +27 -0
  61. data/app/views/masq/shared/_error_messages.html.erb +12 -0
  62. data/app/views/masq/sites/edit.html.erb +42 -0
  63. data/app/views/masq/sites/index.html.erb +20 -0
  64. data/config/initializers/configuration.rb +5 -0
  65. data/config/initializers/mime_types.rb +1 -0
  66. data/config/initializers/requires.rb +6 -0
  67. data/config/locales/de.yml +281 -0
  68. data/config/locales/en.yml +271 -0
  69. data/config/locales/es.yml +254 -0
  70. data/config/locales/nl.yml +258 -0
  71. data/config/locales/rails.de.yml +225 -0
  72. data/config/locales/ru.yml +272 -0
  73. data/config/masq.example.yml +132 -0
  74. data/config/routes.rb +41 -0
  75. data/db/migrate/20120312120000_masq_schema.rb +152 -0
  76. data/db/migrate/20130626220915_remame_last_authenticated_with_yubikey_on_masq_accounts.rb +11 -0
  77. data/db/migrate/20130704205532_add_first_and_lastname_columns_to_personas.rb +11 -0
  78. data/db/migrate/20130807060329_change_open_id_associations_server_url_column_type.rb +22 -0
  79. data/lib/masq/active_record_openid_store/association.rb +16 -0
  80. data/lib/masq/active_record_openid_store/nonce.rb +9 -0
  81. data/lib/masq/active_record_openid_store/openid_ar_store.rb +58 -0
  82. data/lib/masq/authenticated_system.rb +136 -0
  83. data/lib/masq/engine.rb +12 -0
  84. data/lib/masq/openid_server_system.rb +110 -0
  85. data/lib/masq/signup.rb +53 -0
  86. data/lib/masq/version.rb +5 -0
  87. data/lib/masq.rb +50 -0
  88. data/lib/masq2.rb +1 -0
  89. data/lib/tasks/masq_tasks.rake +58 -0
  90. data.tar.gz.sig +2 -0
  91. metadata +377 -0
  92. metadata.gz.sig +0 -0
@@ -0,0 +1,272 @@
1
+ ru:
2
+
3
+ # account controller
4
+ thanks_for_signing_up_activation_link: Спасибо за регистрацию! Мы выслали вам письмо со ссылкой для активации учётной записи.
5
+ thanks_for_signing_up: Спасибо за регистрацию!
6
+ activation_link_resent: Мы выслали вам письмо со ссылкой для активации учётной записи.
7
+ profile_updated: Ваш профиль был изменён.
8
+ account_disabled: Ваша учётная запись была отключена.
9
+ entered_password_is_wrong: The entered password is wrong.
10
+ account_activated_login_now: Your account is activated - you can login now.
11
+ couldnt_find_account_with_code_create_new_one: We could not find any account with the given activation code. Please create a new account.
12
+ account_already_activated_please_login: Your account is already activated - please login.
13
+ account_already_activated_or_missing: "The account is already activated or doesn't exist."
14
+ password_has_been_changed: Ваш пароль был изменён.
15
+ sorry_password_couldnt_be_changed: Sorry, your password could not be changed.
16
+ confirmation_of_new_password_invalid: The confirmation of the new password was incorrect.
17
+ old_password_incorrect: Your old password is incorrect.
18
+ # account views
19
+ public_persona: Публичная персона
20
+ forgot_password_create_new_one: You forgot your password? Here you can create a new one
21
+ account_created_but_not_activated_yet: Your OpenID account has been created, but it is not activated, yet.#
22
+ please_activate_it_by_clicking_the_following_link: Please activate it by clicking the following link
23
+ my_profile: Мой профиль
24
+ login: Учётная запись
25
+ password: Пароль
26
+ my_password: Мой пароль
27
+ old_password: Старый пароль
28
+ new_password_minimum_6_characters: Новый пароль <span class="note">(минимум 6 символов)</span>
29
+ password_confirmation: Подтверждение пароля
30
+ submit_update: изменить
31
+ my_yubikey: Мой Yubikey
32
+ your_account_is_associated_with_the_yubico_identity: Ваша учётная запись связана с идентификатором Yubico
33
+ yubikey_how_to_use: "You can use the Yubikey in addition to your password to sign into your account. Just enter your normal
34
+ password and your Yubico OTP (not seperated by spaces or anything) at the login page."
35
+ remove_association: remove association
36
+ your_yubikey_a_one_time_password: Your Yubikey <span class="note">(a Yubico one time password)</span>
37
+ associate_account_with_yubikey: associate my account with this Yubikey
38
+ your_yubikey_is_optional_for_login: Your Yubikey is currently optional for login.
39
+ make_my_yubikey_mandatory: Make my Yubikey mandatory for login
40
+ your_yubikey_is_mandatory_for_login: Your Yubikey is currently mandatory for login.
41
+ make_my_yubikey_optional: Make my Yubikey optional for login
42
+ disable_my_account: Отключить мою учётную запись
43
+ wont_be_possible_to_reclaim_identifier: Please consider that it won't be possible to reclaim your current OpenID identifier
44
+ confirm_by_entering_password: Confirm this step by entering your password
45
+ delete_my_account_and_data: удалить мою учётную запись и все мои данные
46
+
47
+ signup_title: Регистрация
48
+ signup: Signup # ???
49
+ resend_activation_email: resend activation email
50
+
51
+ # account mailer
52
+ please_activate_your_account: Пожалуйста, активируйте вашу учётную запись
53
+ your_request_for_a_new_password: Your request for a new password
54
+ activation_link: Ссылка на активацию учётной записи
55
+
56
+ # consumer controller
57
+ immediate_request_failed_setup_needed: Immediate request failed - setup needed
58
+ openid_transaction_cancelled: OpenID-транзакция отменена.
59
+ verification_of_identifier_failed: "Verification of %{identifier} failed: %{message}"
60
+ verification_failed_message: "Verification failed: %{message}"
61
+ verification_of_identifier_succeeded: Verification of %{identifier} succeeded.
62
+ simple_registration_data_requested: Simple Registration data was requested
63
+ but_none_was_returned: but none was returned.
64
+ but_got_no_response: but got no response.
65
+ but_an_error_occured: "but an error occured:\n%{error_message}"
66
+ and_saved_at_the_identity_provider: and saved at the Identity Provider.
67
+ the_following_data_were_sent: "The following data were sent:"
68
+ attribute_exchange_data_requested: Attribute Exchange data was requested
69
+ attribute_exchange_store_requested: Attribute Exchange Store request sent
70
+ authentication_policies_requested: Authentication policies were requested
71
+ and_server_reported_the_following: "and the server reported the following:"
72
+ but_the_server_did_not_report_one: but the server did not report one.
73
+ authentication_time: Authentication time
74
+
75
+ # consumer views
76
+ identifier: Идентификатор
77
+ verify: Verify
78
+ use_immediate_mode: Use immediate mode
79
+ request_registration_data: Request registration data
80
+ request_attribute_exchange_data: Request attribute exchange data
81
+ store_attribute_exchange_data: Store attributes with attribute exchange
82
+ request_pape: Request phishing-resistent auth policy (PAPE)
83
+ force_post: Force the transaction to use POST by adding 2K of extra data
84
+
85
+ # info
86
+ questions_answers: Вопросы? Ответы!
87
+ here_we_cover_openid_topics: Here we cover some OpenID related topics.
88
+ openid_delegation: Делегирование OpenID
89
+ delegation_explanation: "Делегирование - это способ использовать URL вашего собственного веб-сайта или блога в качестве OpenID-идентификатора. Requests can
90
+ be forwarded to this server by
91
+ adding the following HTML fragment to the <code>&lt;head&gt;</code>
92
+ of your site:"
93
+ get_your_openid: Get your OpenID
94
+ openid_intro: "<p>OpenID is a shared identity service, which allows you to log on to many different
95
+ web sites using a single digital identity, eliminating the need for different user names
96
+ and passwords for each site.</p>
97
+ <p>OpenID is a decentralized, free and open standard that lets you control the amount of
98
+ personal information that you would like to provide to other web sites.</p>"
99
+ openid_intro_link: "<p>Get started and %{signup_link}.</p>"
100
+ signup_for_an_openid: signup for an OpenID
101
+ login_to_proceed: Please log in to proceed
102
+ host_requests_identification_you_need_to_login: "%{host} requests your identification and you need to log in to proceed."
103
+ login_intro: "To log in, please navigate to <strong>%{login_url}</strong>. The page your
104
+ are currently viewing is used to <strong>protect yourself from phishing and online identity theft</strong>
105
+ and should contain no links.<br />If there are any links, please report to us, who sent you here."
106
+
107
+ # nav
108
+ nav_identity: идентификатор
109
+ nav_profile: профиль
110
+ nav_personas: персоны
111
+ nav_trusted_sites: доверенные сайты
112
+ logout: выход
113
+ current_verification_request: current verification request
114
+ login_link: вход
115
+ signup_link: регистрация
116
+ help: помощь
117
+ get_help: получить помощь
118
+ openid_consumer_testsuite_title: OpenID Consumer Testsuite
119
+ relying_party_title: Зависимая сторона
120
+
121
+ # passwords controller
122
+ password_reset_link_has_been_sent: A password reset link has been sent to your email address.
123
+ could_not_find_user_with_email_address: Could not find a user with that email address.
124
+ password_reset: Password reset.
125
+ password_mismatch: Password mismatch.
126
+ password_cannot_be_blank: Password cannot be blank.
127
+ reset_code_invalid_try_again: Sorry, your password reset code is invalid. Please check the code and try again.
128
+
129
+ # passwords views
130
+ reset_password: reset password
131
+ forgot_password_title: Forgot password
132
+ please_enter_email: Please enter your email address
133
+ submit_send: отправить
134
+
135
+ # personas controller
136
+ persona_successfully_created: Персона была успешно создана.
137
+ persona_updated: Персона была изменена.
138
+ persona_cannot_be_deleted: Эта персона не может быть удалена.
139
+
140
+ # personas views
141
+ edit_your_persona: Редактировать вашу персону «{title}»
142
+ personal_information: Личная информация
143
+ professional_information: Профессиональная информация
144
+ phone: Телефон
145
+ instant_messaging: Instant Messaging
146
+ other_information: Другая информация
147
+
148
+ nickname: Псевдоним
149
+ email: Email
150
+ address: Адрес
151
+ postcode: Почтовый индекс
152
+ city: Город
153
+ state: Область
154
+ country: Страна
155
+ language: Язык
156
+ timezone: Часовой пояс
157
+ gender: Пол
158
+ company_name: Организация
159
+ job_title: Должность
160
+ phone_home: Домашний телефон
161
+ phone_mobile: Мобильный телефон
162
+ phone_fax: Факс
163
+ phone_work: Рабочий телефон
164
+ biography: Биография
165
+ title: Title
166
+ fullname: Full name
167
+ birth_date: День рождения
168
+ address_business: Адрес работы
169
+ address_additional: Дополнительный адрес
170
+ address_additional_business: Дополнительный адрес работы
171
+ postcode_business: Почтовый индекс работы
172
+ city_business: Город работы
173
+ state_business: Область работы
174
+ country_business: Страна работы
175
+ im_aim: AIM
176
+ im_icq: ICQ
177
+ im_msn: MSN
178
+ im_yahoo: Yahoo
179
+ im_jabber: Jabber
180
+ im_skype: Skype
181
+ image_url: Image URL
182
+ website_url: URL веб-сайта
183
+ blog_url: URL блога
184
+ dob: День рождения
185
+ date_of_birth: День рождения
186
+
187
+ my_personas_title: Мои персоны
188
+ personas_intro: "Personas define certain roles of your account. For instance you can have a persona for private
189
+ use and another one for business context. When a relying party requests your information
190
+ you can choose the persona that you would like to exchange data from."
191
+ edit: редактировать
192
+ delete: удалить
193
+ really_want_to_delete_persona: Вы действительно хотите удалить персону «%{title}»?
194
+ create_a_new_persona: create a new persona
195
+ create_a_new_persona_title: Create a new persona
196
+
197
+ # sessions controller
198
+ you_are_logged_in: You are now logged in.
199
+ account_not_yet_activated: Your account is not activated, yet.
200
+ login_incorrect: The login is incorrect.
201
+ password_incorrect: The password is incorrect.
202
+ you_are_now_logged_out: You are now logged out.
203
+ account_deactivated: Your account is deactivated.
204
+
205
+ # sessions views
206
+ login_title: Вход
207
+ your_openid: Ваш OpenID
208
+ cancel_this_request: отменить этот запрос
209
+ remember_me: Запомнить меня
210
+ login_submit: вход
211
+ i_forgot_my_password: Я забыл свой пароль
212
+
213
+ # server controller
214
+ this_is_openid_not_a_human_resource: This is an OpenID server endpoint, not a human readable resource.
215
+ identity_verification_request_invalid: The identity verification request is invalid.
216
+ service_provider_requires_reauthentication_last_login_too_long_ago: The Service Provider requires reauthentication, because your last login is too long ago.
217
+ login_to_verify_identity: Please log in to verify your identity.
218
+
219
+ # server views
220
+ identity_request_from_host: Запрос идентификатора от %{host}
221
+ identity_request_missing_persona: Please %{create_link} to answer the identity request.
222
+ trust_root_requests_some_personal_data: "%{trust_root} requests some personal data."
223
+ trust_root_sends_some_personal_data: "%{trust_root} sends some personal data:"
224
+ trust_root_requires_authentication: "%{trust_root} requires your authentication."
225
+ select_information_to_submit: Пожалуйста, выберите информацию, котрую вы хотите отправить.
226
+ select_information_to_accept: Пожалуйста, выберите информацию, котрую вы хотите принять.
227
+ attributes_are_shown_from_persona: The attributes shown are from your persona %{persona}.
228
+ attributes_will_be_added_to_persona: The attributes will be added to your persona %{persona} (%{choose_link}).
229
+ to_submit_other_values_you_can_edit_or_choose: To submit other values you can %{edit_link} or %{choose_link}.
230
+ create_persona_link: создать персону
231
+ edit_persona_link: редактировать персону
232
+ choose_other_persona: выбрать другую персону
233
+ choose_persona_title: Выбрать персону
234
+ choose_persona_submit: выбрать персону
235
+ create_new_persona_link: создать новую персону
236
+ requested_information_title: Запрошенная информация
237
+ sent_information_title: Отправленная информация
238
+ disclosure: disclosure
239
+ accept: принять
240
+ current: текущий
241
+ required: обязательно
242
+ optional: не обязательно
243
+ not_supported: не поддерживается
244
+ trust_site_only_this_time: Доверить этому сайту только в этот раз
245
+ always_trust_site: Всегда доверять этому сайту
246
+ approve_request: Подтвердить этот запрос
247
+ cancel_request: Отменить этот запрос
248
+
249
+ # sites controllers
250
+ release_policy_for_site_updated: The release policy for this site has been updated.
251
+
252
+ # sites views
253
+ edit_link: редактировать
254
+ delete_link: удалить
255
+ or: или
256
+ your_release_policy_for_site: Your release policy for %{site}
257
+ persona_label: Персона
258
+ property: свойство
259
+ value: значение
260
+ update_release_policy_submit: update release policy
261
+ identity_request_answered_without_interaction: Identity request from the following sites are answered directly without further interaction.
262
+ alter_release_policies_here: You can alter the release policies for these sites here.
263
+ really_want_to_delete_trust_for_site: Do you really want to delete the trust for %{site}?
264
+ no_entries_yet: There are no entries, yet.
265
+ ext0: Ext0
266
+ ext1: Ext1
267
+ ext2: Ext2
268
+
269
+ # yubikey controller
270
+ account_associated_with_yubico_identity: Ваша учётная запись была ассоциирована с вашим идентификатором Yubico.
271
+ sorry_yubico_one_time_password_incorrect: Sorry, the given Yubico one time password is incorrect.
272
+ account_disassociated_from_yubico_identity: Your account has been disassociated from the Yubico identity.
@@ -0,0 +1,132 @@
1
+ ---
2
+ default: &default
3
+ send_activation_mail: true
4
+ trust_basic_auth: false
5
+ disable_registration: false
6
+ force_default_persona: false
7
+ can_change_password: true
8
+ can_disable_account: true
9
+ can_use_yubikey: true
10
+ create_auth_ondemand:
11
+ enabled: false
12
+ default_mail_domain: example.com
13
+ random_password: true
14
+ protect_phishing: true
15
+ name: masq
16
+ host: localhost:3000
17
+ email: info@your.domain.com
18
+ use_ssl: false
19
+ email_as_login: false
20
+ yubico:
21
+ id: 99
22
+ api_key: youryubicoapikey
23
+ attribute_mappings:
24
+ nickname:
25
+ - nickname
26
+ - http://axschema.org/namePerson/friendly
27
+ email:
28
+ - email
29
+ - http://axschema.org/contact/email
30
+ fullname:
31
+ - fullname
32
+ - http://axschema.org/namePerson
33
+ firstname:
34
+ - firstname
35
+ - http://axschema.org/namePerson/first
36
+ surname:
37
+ - surname
38
+ - http://axschema.org/namePerson/last
39
+ postcode:
40
+ - postcode
41
+ - http://axschema.org/contact/postalCode/home
42
+ country:
43
+ - country
44
+ - http://axschema.org/contact/country/home
45
+ language:
46
+ - language
47
+ - http://axschema.org/pref/language
48
+ timezone:
49
+ - timezone
50
+ - http://axschema.org/pref/timezone
51
+ gender:
52
+ - gender
53
+ - http://axschema.org/person/gender
54
+ date_of_birth:
55
+ - dob
56
+ - http://axschema.org/birthDate
57
+ dob_day:
58
+ - dob_day
59
+ - http://axschema.org/birthDate/birthday
60
+ dob_month:
61
+ - dob_month
62
+ - http://axschema.org/birthDate/birthMonth
63
+ dob_year:
64
+ - dob_year
65
+ - http://axschema.org/birthDate/birthYear
66
+ address:
67
+ - http://axschema.org/contact/postalAddress/home
68
+ address_additional:
69
+ - http://axschema.org/contact/postalAddressAdditional/home
70
+ city:
71
+ - http://axschema.org/contact/city/home
72
+ state:
73
+ - http://axschema.org/contact/state/home
74
+ company_name:
75
+ - http://axschema.org/company/name
76
+ job_title:
77
+ - http://axschema.org/company/title
78
+ address_business:
79
+ - http://axschema.org/contact/postalAddress/business
80
+ address_additional_business:
81
+ - http://axschema.org/contact/postalAddressAdditional/business
82
+ postcode_business:
83
+ - http://axschema.org/contact/postalCode/business
84
+ city_business:
85
+ - http://axschema.org/contact/city/business
86
+ state_business:
87
+ - http://axschema.org/contact/state/business
88
+ country_business:
89
+ - http://axschema.org/contact/country/business
90
+ phone_home:
91
+ - http://axschema.org/contact/phone/home
92
+ phone_mobile:
93
+ - http://axschema.org/contact/phone/cell
94
+ phone_work:
95
+ - http://axschema.org/contact/phone/business
96
+ phone_fax:
97
+ - http://axschema.org/contact/phone/fax
98
+ im_aim:
99
+ - http://axschema.org/contact/IM/AIM
100
+ im_icq:
101
+ - http://axschema.org/contact/IM/ICQ
102
+ im_msn:
103
+ - http://axschema.org/contact/IM/MSN
104
+ im_yahoo:
105
+ - http://axschema.org/contact/IM/Yahoo
106
+ im_jabber:
107
+ - http://axschema.org/contact/IM/Jabber
108
+ im_skype:
109
+ - http://axschema.org/contact/IM/Skype
110
+ image_default:
111
+ - http://axschema.org/media/image/default
112
+ biography:
113
+ - http://axschema.org/media/biography
114
+ web_default:
115
+ - http://axschema.org/contact/web/default
116
+ web_blog:
117
+ - http://axschema.org/contact/web/blog
118
+ trusted_domains:
119
+
120
+ development:
121
+ <<: *default
122
+
123
+ test:
124
+ <<: *default
125
+ trusted_domains:
126
+ - trusted-domain.com
127
+
128
+ production:
129
+ <<: *default
130
+ use_ssl: true
131
+ ssl_certificate_common_name: your.domain.com
132
+ ssl_certificate_sha1: D2:1B:D8:C4:39:B7:EE:10:DA:E2:4E:0A:65:98:8E:27:C9:32:4B:F0
data/config/routes.rb ADDED
@@ -0,0 +1,41 @@
1
+ Masq::Engine.routes.draw do
2
+ resource :account do
3
+ get :activate
4
+ get :password
5
+ put :change_password
6
+
7
+ resources :personas
8
+ resources :sites
9
+ resource :yubikey_association, only: [:create, :destroy]
10
+ end
11
+
12
+ resource :password
13
+ resource :session, only: [:new, :create, :destroy]
14
+
15
+ get "/help" => "info#help", :as => :help
16
+ get "/safe-login" => "info#safe_login", :as => :safe_login
17
+
18
+ get "/forgot_password" => "passwords#new", :as => :forgot_password
19
+ get "/reset_password/:id" => "passwords#edit", :as => :reset_password
20
+
21
+ get "/login" => "sessions#new", :as => :login
22
+ get "/logout" => "sessions#destroy", :as => :logout
23
+ delete "/logout" => "sessions#destroy"
24
+ post "/resend_activation_email/*account" => "accounts#resend_activation_email", :as => :resend_activation_email
25
+
26
+ match "/server" => "server#index", :as => :server, :via => [:get, :post]
27
+ match "/server/decide" => "server#decide", :as => :decide, :via => [:get, :post]
28
+ match "/server/proceed" => "server#proceed", :as => :proceed, :via => [:get, :post]
29
+ match "/server/complete" => "server#complete", :as => :complete, :via => [:get, :post]
30
+ match "/server/cancel" => "server#cancel", :as => :cancel, :via => [:get, :post]
31
+ get "/server/seatbelt/config.:format" => "server#seatbelt_config", :as => :seatbelt_config
32
+ get "/server/seatbelt/state.:format" => "server#seatbelt_login_state", :as => :seatbelt_state
33
+
34
+ get "/consumer" => "consumer#index", :as => :consumer
35
+ post "/consumer/start" => "consumer#start", :as => :consumer_start
36
+ match "/consumer/complete" => "consumer#complete", :as => :consumer_complete, :via => [:get, :post]
37
+
38
+ get "/*account" => "accounts#show", :as => :identity, :constraints => {format: /\.xrds/}
39
+
40
+ root to: "info#index"
41
+ end
@@ -0,0 +1,152 @@
1
+ class MasqSchema < ActiveRecord::Migration[4.2]
2
+ def change
3
+ # Check for existing masquerade tables. In case the tables already exist,
4
+ # upgrade the database by renaming the tables - otherwise create them.
5
+
6
+ # Accounts: Also check for columns, as account is a pretty generic model name,
7
+ # and we don't want to conflict with an existing account tables that's not
8
+ # from an existing masquerade installation
9
+ if table_exists?(:accounts) && column_exists?(:accounts, :public_persona_id) &&
10
+ column_exists?(:accounts, :yubico_identity)
11
+ rename_table(:accounts, :masq_accounts)
12
+ else
13
+ create_table(:masq_accounts, force: true) do |t|
14
+ t.boolean(:enabled, default: true)
15
+ t.string(:login, null: false)
16
+ t.string(:email, null: false)
17
+ t.string(:crypted_password, limit: 40, null: false)
18
+ t.string(:salt, limit: 40, null: false)
19
+ t.string(:remember_token)
20
+ t.string(:password_reset_code, limit: 40)
21
+ t.string(:activation_code, limit: 40)
22
+ t.string(:yubico_identity, limit: 12)
23
+ t.integer(:public_persona_id)
24
+ t.datetime(:last_authenticated_at)
25
+ t.boolean(:last_authenticated_by_yubikey)
26
+ t.boolean(:yubikey_mandatory, default: false, null: false)
27
+ t.datetime(:remember_token_expires_at)
28
+ t.datetime(:activated_at)
29
+ t.datetime(:created_at)
30
+ t.datetime(:updated_at)
31
+ end
32
+
33
+ add_index(:masq_accounts, [:email], unique: true)
34
+ add_index(:masq_accounts, [:login], unique: true)
35
+ end
36
+
37
+ # OpenID Associations
38
+ if table_exists?(:open_id_associations)
39
+ rename_table(:open_id_associations, :masq_open_id_associations)
40
+ else
41
+ create_table(:masq_open_id_associations, force: true) do |t|
42
+ t.binary(:server_url)
43
+ t.binary(:secret)
44
+ t.string(:handle)
45
+ t.string(:assoc_type)
46
+ t.integer(:issued)
47
+ t.integer(:lifetime)
48
+ end
49
+ end
50
+
51
+ # OpenID Nonces
52
+ if table_exists?(:open_id_nonces)
53
+ rename_table(:open_id_nonces, :masq_open_id_nonces)
54
+ else
55
+ create_table(:masq_open_id_nonces, force: true) do |t|
56
+ t.string(:server_url, null: false)
57
+ t.string(:salt, null: false)
58
+ t.integer(:timestamp, null: false)
59
+ end
60
+ end
61
+
62
+ # OpenID Requests
63
+ if table_exists?(:open_id_requests)
64
+ rename_table(:open_id_requests, :masq_open_id_requests)
65
+ else
66
+ create_table(:masq_open_id_requests, force: true) do |t|
67
+ t.string(:token, limit: 40)
68
+ t.text(:parameters)
69
+ t.datetime(:created_at)
70
+ t.datetime(:updated_at)
71
+ end
72
+ add_index(:masq_open_id_requests, [:token], unique: true)
73
+ end
74
+
75
+ # Personas
76
+ if table_exists?(:personas)
77
+ rename_table(:personas, :masq_personas)
78
+ else
79
+ create_table(:masq_personas, force: true) do |t|
80
+ t.integer(:account_id, null: false)
81
+ t.string(:title, null: false)
82
+ t.string(:nickname)
83
+ t.string(:email)
84
+ t.string(:fullname)
85
+ t.string(:postcode)
86
+ t.string(:country)
87
+ t.string(:language)
88
+ t.string(:timezone)
89
+ t.string(:gender, limit: 1)
90
+ t.string(:address)
91
+ t.string(:address_additional)
92
+ t.string(:city)
93
+ t.string(:state)
94
+ t.string(:company_name)
95
+ t.string(:job_title)
96
+ t.string(:address_business)
97
+ t.string(:address_additional_business)
98
+ t.string(:postcode_business)
99
+ t.string(:city_business)
100
+ t.string(:state_business)
101
+ t.string(:country_business)
102
+ t.string(:phone_home)
103
+ t.string(:phone_mobile)
104
+ t.string(:phone_work)
105
+ t.string(:phone_fax)
106
+ t.string(:im_aim)
107
+ t.string(:im_icq)
108
+ t.string(:im_msn)
109
+ t.string(:im_yahoo)
110
+ t.string(:im_jabber)
111
+ t.string(:im_skype)
112
+ t.string(:image_default)
113
+ t.string(:biography)
114
+ t.string(:web_default)
115
+ t.string(:web_blog)
116
+ t.integer(:dob_day, limit: 2)
117
+ t.integer(:dob_month, limit: 2)
118
+ t.integer(:dob_year)
119
+ t.boolean(:deletable, default: true, null: false)
120
+ t.datetime(:created_at)
121
+ t.datetime(:updated_at)
122
+ end
123
+ add_index(:masq_personas, [:account_id, :title], unique: true)
124
+ end
125
+
126
+ # Release Policies
127
+ if table_exists?(:release_policies)
128
+ rename_table(:release_policies, :masq_release_policies)
129
+ else
130
+ create_table(:masq_release_policies, force: true) do |t|
131
+ t.integer(:site_id, null: false)
132
+ t.string(:property, null: false)
133
+ t.string(:type_identifier)
134
+ end
135
+ add_index(:masq_release_policies, [:site_id, :property, :type_identifier], name: :index_masq_release_policies, unique: true)
136
+ end
137
+
138
+ # Sites
139
+ if table_exists?(:sites)
140
+ rename_table(:sites, :masq_sites)
141
+ else
142
+ create_table(:masq_sites, force: true) do |t|
143
+ t.integer(:account_id, null: false)
144
+ t.integer(:persona_id, null: false)
145
+ t.string(:url, null: false)
146
+ t.datetime(:created_at)
147
+ t.datetime(:updated_at)
148
+ end
149
+ add_index(:masq_sites, [:account_id, :url], unique: true)
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,11 @@
1
+ class RemameLastAuthenticatedWithYubikeyOnMasqAccounts < ActiveRecord::Migration[4.2]
2
+ def up
3
+ # Rename the last last_authenticated_with_yubikey to be within the 30 char column name limit set by Oracle.
4
+ if table_exists?(:masq_accounts) && column_exists?(:masq_accounts, :last_authenticated_with_yubikey)
5
+ rename_column(:masq_accounts, :last_authenticated_with_yubikey, :last_authenticated_by_yubikey)
6
+ end
7
+ end
8
+
9
+ def down
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class AddFirstAndLastnameColumnsToPersonas < ActiveRecord::Migration[4.2]
2
+ def change
3
+ if table_exists?(:masq_personas) && !column_exists?(:masq_personas, :firstname)
4
+ add_column(:masq_personas, :firstname, :string)
5
+ end
6
+
7
+ if table_exists?(:masq_personas) && !column_exists?(:masq_personas, :surname)
8
+ add_column(:masq_personas, :surname, :string)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ class ChangeOpenIdAssociationsServerUrlColumnType < ActiveRecord::Migration[4.2]
2
+ def up
3
+ # Only run if the column type is not already a varchar/string.
4
+ if Masq::Association.columns_hash["server_url"].type != :string
5
+
6
+ # Create a new column to move the data to and rename the old one
7
+ rename_column(:masq_open_id_associations, :server_url, :binary_server_url)
8
+ add_column(:masq_open_id_associations, :server_url, :string, limit: 2000)
9
+
10
+ # Copy the data over since we cant change a binary column type
11
+ Masq::Association.all.each do |record|
12
+ record.update_attribute(:server_url, record.binary_server_url.to_s)
13
+ end
14
+
15
+ # Remove the old column
16
+ remove_column(:masq_open_id_associations, :binary_server_url)
17
+ end
18
+ end
19
+
20
+ def down
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "openid/association"
4
+ require "active_record"
5
+
6
+ module Masq
7
+ class Association < ActiveRecord::Base
8
+ self.table_name = "masq_open_id_associations"
9
+
10
+ # attr_accessible :server_url, :handle, :secret, :issued, :lifetime, :assoc_type
11
+
12
+ def from_record
13
+ OpenID::Association.new(handle, secret, issued, lifetime, assoc_type)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ require "active_record"
2
+
3
+ module Masq
4
+ class Nonce < ActiveRecord::Base
5
+ self.table_name = "masq_open_id_nonces"
6
+
7
+ # attr_accessible :server_url, :timestamp, :salt
8
+ end
9
+ end