Merge branch 'master' of github.com:/nextcloud/twofactor_u2f into testing/validate-info-xml

This commit is contained in:
Christoph Wurst 2018-05-28 07:58:18 +02:00
Родитель efd304e9ee bfa68feb7f
Коммит 646dd87e93
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
36 изменённых файлов: 3959 добавлений и 4039 удалений

76
.github/ISSUE_TEMPLATE/bug.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,76 @@
---
name: 🐛 Bug
about: Have you encountered a bug?
version: 0.1
---
### Steps to reproduce
1.
2.
3.
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
### Server configuration
**Operating system**:
**Web server:**
**Database:**
**PHP version:**
**Version:** (see admin page)
**Updated from an older version or fresh install:**
**List of activated apps:**
```
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your server installation folder
```
**The content of config/config.php:**
```
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder
or
Insert your config.php content here
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)
```
#### Client configuration
**Browser:**
**Operating system:**
#### Logs
##### Web server error log
```
Insert your webserver log here
```
##### Server log (data/nextcloud.log)
```
Insert your server log here
```
##### Browser log
```
Insert your browser log here, this could for example include:
a) The javascript console log
b) The network log
```

13
.github/ISSUE_TEMPLATE/feature_request.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,13 @@
---
name: 🚀 Feature Request
about: You have a neat idea that should be implemented?
version: 0.1
---
### Feature Request
<!-- Fill in the relevant information below to help triage your issue. -->
#### Summary
<!-- Provide a summary of the feature you would like to see implemented. -->

13
.github/ISSUE_TEMPLATE/question.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,13 @@
---
name: 🙋 Question
about: Do you have a question about the app?
version: 0.1
---
### Question
<!-- Fill in the relevant information below to help triage your question. -->
#### Summary
<!-- Provide a summary of your question (if applicable). -->

Просмотреть файл

@ -1,3 +1,10 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run --enable-security-analysis
filter:
excluded_paths:
- 'js/tests/*'

Просмотреть файл

@ -41,7 +41,7 @@ matrix:
branches:
only:
- master
- "/^stable\\d+(\\.\\d+)?$/"
- "/^stable\\d+(\\.\\d+)?+(\\.\\d+)?$/"
- /^v\d++(\.\d+)?+(\.\d+)?+(\.\d+)?$/
cache:

Просмотреть файл

@ -1,6 +1,20 @@
# Changelog
All notable changes to this project will be documented in this file.
## 1.5.5 – 2018-05-14
### Fixed
- Installation on Nextcloud 13.x
## 1.5.3 – 2018-04-30
### Fixed
- Allow Nextcloud 13.0.2
## 1.5.2 – 2018-03-28
### Changed
- Requires Nextcloud 13.0.1
### Fixed
- U2F on Firefox Quantum and mobile browsers
## 1.5.1 – 2018-01-09
### Added
- New and updated translations

Просмотреть файл

@ -1,9 +1,11 @@
# U2F second factor provider for Nextcloud
![Downloads](https://img.shields.io/github/downloads/nextcloud/twofactor_u2f/total.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/?branch=master)
[![Build Status](https://api.travis-ci.org/nextcloud/twofactor_u2f.svg?branch=master)](https://travis-ci.org/nextcloud/twofactor_u2f)
[![JavaScript Coverage Status](https://coveralls.io/repos/github/nextcloud/twofactor_u2f/badge.svg?branch=master)](https://coveralls.io/github/nextcloud/twofactor_u2f?branch=master)
|branch|target Nextcloud version|build status and code metrics|
|---|---|---|
|master| Nextcloud 14.0.x | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/?branch=master) [![Build Status](https://api.travis-ci.org/nextcloud/twofactor_u2f.svg?branch=master)](https://travis-ci.org/nextcloud/twofactor_u2f) [![JavaScript Coverage Status](https://coveralls.io/repos/github/nextcloud/twofactor_u2f/badge.svg?branch=master)](https://coveralls.io/github/nextcloud/twofactor_u2f?branch=master)
| stable1.5.5 | Nextcloud 13.x | [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/badges/quality-score.png?b=stable1.5.5)](https://scrutinizer-ci.com/g/nextcloud/twofactor_u2f/?branch=stable1.5.5) [![Build Status](https://api.travis-ci.org/nextcloud/twofactor_u2f.svg?branch=stable1.5.5)](https://travis-ci.org/nextcloud/twofactor_u2f) [![JavaScript Coverage Status](https://coveralls.io/repos/github/nextcloud/twofactor_u2f/badge.svg?branch=stable1.5.5)](https://coveralls.io/github/nextcloud/twofactor_u2f?branch=stable1.5.5) |
![](screenshots/challenge.png)
@ -11,7 +13,9 @@
In order to use this app for authentication, you have to use a browser that supports the U2F standard:
* Google Chrome
* Chromium
* Firefox in combination with [this extension](https://addons.mozilla.org/en-US/firefox/addon/u2f-support-add-on/)
* Firefox
* V56 or before: In combination with [this extension](https://addons.mozilla.org/en-US/firefox/addon/u2f-support-add-on/)
* V57 or newer: After activation of `security.webauth.u2f` in `about:config`
* Opera
## Login with external apps

Просмотреть файл

@ -4,7 +4,7 @@
<name>Two Factor U2F</name>
<summary>U2F two-factor provider</summary>
<description>A two-factor provider for U2F devices</description>
<version>1.5.1</version>
<version>1.6.0</version>
<licence>agpl</licence>
<author>Christoph Wurst</author>
<namespace>TwoFactorU2F</namespace>

18
composer.lock сгенерированный
Просмотреть файл

@ -49,12 +49,12 @@
"source": {
"type": "git",
"url": "https://github.com/ChristophWurst/nextcloud_composer.git",
"reference": "bc6390f8d87e31c6c695bfc1bce4e000cec487c3"
"reference": "0ae1bf929545914b0b0db5979d1510c331fe799e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/bc6390f8d87e31c6c695bfc1bce4e000cec487c3",
"reference": "bc6390f8d87e31c6c695bfc1bce4e000cec487c3",
"url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/0ae1bf929545914b0b0db5979d1510c331fe799e",
"reference": "0ae1bf929545914b0b0db5979d1510c331fe799e",
"shasum": ""
},
"type": "library",
@ -74,7 +74,7 @@
}
],
"description": "Composer package containing Nextcloud's public API (classes, interfaces)",
"time": "2018-02-26T10:06:58+00:00"
"time": "2018-04-13T15:48:57+00:00"
},
{
"name": "doctrine/instantiator",
@ -743,16 +743,16 @@
},
{
"name": "phpunit/phpunit",
"version": "6.5.7",
"version": "6.5.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9"
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6bd77b57707c236833d2b57b968e403df060c9d9",
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
"reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
"shasum": ""
},
"require": {
@ -823,7 +823,7 @@
"testing",
"xunit"
],
"time": "2018-02-26T07:01:09+00:00"
"time": "2018-04-10T11:38:34+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",

Просмотреть файл

@ -3,19 +3,19 @@ OC.L10N.register(
{
"No U2F devices configured. You are not using U2F as second factor at the moment." : "Nejsou nastavena žádná U2F zařízení. Aktuálně nepoužíváte U2F jako druhý faktor.",
"The following devices are configured for U2F second-factor authentication:" : "Následující zařízení jsou nastavena jako druhý faktor autentizace pomocí U2F:",
"Unnamed device" : "Nepojmenované zařízení",
"Unnamed device" : "Nenazvané zařízení",
"Remove" : "Odstranit",
"Add U2F device" : "Přidat U2F zařízení",
"You can add as many devices as you like. It is recommended to give each device a distinct name." : "Můžete přidat tolik zařízení, kolik chcete. Doporučuje se každému dát unikátní jméno.",
"Adding a new device …" : "Přidávání nového zařízení …",
"Adding a new device …" : "Přidávání nového zařízení…",
"Could not remove your U2F device" : "Nepodařilo se odstranit vaše U2F zařízení",
"Server error while trying to add U2F device" : "Serverová chyba během pokusu o přidání U2F zařízení",
"U2F device is already registered (error code {errorCode})" : "Zařízení U2F je již zaregistrováno (kód chyby {errorCode})",
"U2F device registration timeout reached (error code {errorCode})" : "Vypršel časový limit pro registraci U2F zařízení (kód chyby {errorCode})",
"U2F device registration timeout reached (error code {errorCode})" : "Překročen časový limit pro registraci U2F zařízení (kód chyby {errorCode})",
"U2F device registration failed (error code {errorCode})" : "registrace U2F zařízení selhala (kód chyby {errorCode})",
"Server error while trying to complete U2F device registration" : "Serverová chyba během pokusu o dokončení registrace U2F zařízení",
"You added an U2F hardware token" : "Přidal(a) jste U2F hardwarový token",
"You removed an U2F hardware token" : "Odebral(a) jste U2F hardwarový token",
"You added an U2F hardware token" : "Přidali jste U2F hardwarový token",
"You removed an U2F hardware token" : "Odebrali jste U2F hardwarový token",
"U2F device" : "Zařízení U2F",
"Authenticate with an U2F device" : "Ověření pomocí U2F přístroje",
"Two Factor U2F" : "Dvoufázové U2F",
@ -28,4 +28,4 @@ OC.L10N.register(
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome je jediný prohlížeč podporující U2F přístroje. Musíte nainstalovat \"U2F Support Add-on\" pro Firefox pro použití U2F.",
"U2F device successfully registered." : "U2F přístroj úspěšně zaregistrován."
},
"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;");
"nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;");

Просмотреть файл

@ -1,19 +1,19 @@
{ "translations": {
"No U2F devices configured. You are not using U2F as second factor at the moment." : "Nejsou nastavena žádná U2F zařízení. Aktuálně nepoužíváte U2F jako druhý faktor.",
"The following devices are configured for U2F second-factor authentication:" : "Následující zařízení jsou nastavena jako druhý faktor autentizace pomocí U2F:",
"Unnamed device" : "Nepojmenované zařízení",
"Unnamed device" : "Nenazvané zařízení",
"Remove" : "Odstranit",
"Add U2F device" : "Přidat U2F zařízení",
"You can add as many devices as you like. It is recommended to give each device a distinct name." : "Můžete přidat tolik zařízení, kolik chcete. Doporučuje se každému dát unikátní jméno.",
"Adding a new device …" : "Přidávání nového zařízení …",
"Adding a new device …" : "Přidávání nového zařízení…",
"Could not remove your U2F device" : "Nepodařilo se odstranit vaše U2F zařízení",
"Server error while trying to add U2F device" : "Serverová chyba během pokusu o přidání U2F zařízení",
"U2F device is already registered (error code {errorCode})" : "Zařízení U2F je již zaregistrováno (kód chyby {errorCode})",
"U2F device registration timeout reached (error code {errorCode})" : "Vypršel časový limit pro registraci U2F zařízení (kód chyby {errorCode})",
"U2F device registration timeout reached (error code {errorCode})" : "Překročen časový limit pro registraci U2F zařízení (kód chyby {errorCode})",
"U2F device registration failed (error code {errorCode})" : "registrace U2F zařízení selhala (kód chyby {errorCode})",
"Server error while trying to complete U2F device registration" : "Serverová chyba během pokusu o dokončení registrace U2F zařízení",
"You added an U2F hardware token" : "Přidal(a) jste U2F hardwarový token",
"You removed an U2F hardware token" : "Odebral(a) jste U2F hardwarový token",
"You added an U2F hardware token" : "Přidali jste U2F hardwarový token",
"You removed an U2F hardware token" : "Odebrali jste U2F hardwarový token",
"U2F device" : "Zařízení U2F",
"Authenticate with an U2F device" : "Ověření pomocí U2F přístroje",
"Two Factor U2F" : "Dvoufázové U2F",
@ -25,5 +25,5 @@
"Loading your devices …" : "Načítání vašich zařízení …",
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome je jediný prohlížeč podporující U2F přístroje. Musíte nainstalovat \"U2F Support Add-on\" pro Firefox pro použití U2F.",
"U2F device successfully registered." : "U2F přístroj úspěšně zaregistrován."
},"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
},"pluralForm" :"nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;"
}

Просмотреть файл

@ -22,6 +22,7 @@ OC.L10N.register(
"Please plug in your U2F device and press the device button to authorize." : "Yhdistä U2F-laitteesi ja paina laitteen painiketta tunnistautuaksesi.",
"An error occurred. Please try again." : "Tapahtui virhe. Yritä myöhemmin uudelleen.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Asenna \"U2F Support Add-on\" -lisäosa Firefox-selaimelle käyttääksesi U2F-laitetta. Lisäosaa ei tarvita Chrome-selaimella.",
"You are accessing this site via an insecure connection. Browsers might therefore refuse the U2F authentication." : "Olet yhteydessä tähän sivustoon salaamattomalla yhteydellä. Selaimet saattavat sen vuoksi kieltäytyä U2F-tunnistautumisesta.",
"U2F second-factor auth" : "U2F-kaksivaiheinen tunnistautuminen",
"Loading your devices …" : "Ladataan laitteitasi…",
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome on ainoa selain, joka tukee U2F-laitteita. Asenna \"U2F Support Add-on\" -lisäosa käyttääksesi U2F-laitetta Firefox-selaimella.",

Просмотреть файл

@ -20,6 +20,7 @@
"Please plug in your U2F device and press the device button to authorize." : "Yhdistä U2F-laitteesi ja paina laitteen painiketta tunnistautuaksesi.",
"An error occurred. Please try again." : "Tapahtui virhe. Yritä myöhemmin uudelleen.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Asenna \"U2F Support Add-on\" -lisäosa Firefox-selaimelle käyttääksesi U2F-laitetta. Lisäosaa ei tarvita Chrome-selaimella.",
"You are accessing this site via an insecure connection. Browsers might therefore refuse the U2F authentication." : "Olet yhteydessä tähän sivustoon salaamattomalla yhteydellä. Selaimet saattavat sen vuoksi kieltäytyä U2F-tunnistautumisesta.",
"U2F second-factor auth" : "U2F-kaksivaiheinen tunnistautuminen",
"Loading your devices …" : "Ladataan laitteitasi…",
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome on ainoa selain, joka tukee U2F-laitteita. Asenna \"U2F Support Add-on\" -lisäosa käyttääksesi U2F-laitetta Firefox-selaimella.",

Просмотреть файл

@ -19,6 +19,8 @@ OC.L10N.register(
"U2F device" : "Dispositivo U2F",
"Authenticate with an U2F device" : "Autenticati con un dispositivo U2F",
"Two Factor U2F" : "U2F a due fattori",
"U2F two-factor provider" : "Fornitore a due fattori per U2F",
"A two-factor provider for U2F devices" : "Un fornitore a due fattori per dispositivi U2F",
"Please plug in your U2F device and press the device button to authorize." : "Collega il tuo dispositivo U2F e premi il pulsante del dispositivo per autorizzare.",
"An error occurred. Please try again." : "Si è verificato un errore. Prova ancora.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Installa \"U2F Support Add-on\" su Firefox per utilizzare U2F, ciò non è necessario su Chrome.",

Просмотреть файл

@ -17,6 +17,8 @@
"U2F device" : "Dispositivo U2F",
"Authenticate with an U2F device" : "Autenticati con un dispositivo U2F",
"Two Factor U2F" : "U2F a due fattori",
"U2F two-factor provider" : "Fornitore a due fattori per U2F",
"A two-factor provider for U2F devices" : "Un fornitore a due fattori per dispositivi U2F",
"Please plug in your U2F device and press the device button to authorize." : "Collega il tuo dispositivo U2F e premi il pulsante del dispositivo per autorizzare.",
"An error occurred. Please try again." : "Si è verificato un errore. Prova ancora.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Installa \"U2F Support Add-on\" su Firefox per utilizzare U2F, ciò non è necessario su Chrome.",

Просмотреть файл

@ -28,4 +28,4 @@ OC.L10N.register(
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome-ი ერთადერთი ბრაუზერია რომელიც მხარს უჭერს U2F მოწყობილობებს. Firefox-ით U2F-ით სარგებლობისთვის საჭიროა დააყენოთ \"U2F-ს მხარდაჭერის დანამატი\".",
"U2F device successfully registered." : "U2F მოწყობილობა წარმატებით დარეგისტრირდა."
},
"nplurals=1; plural=0;");
"nplurals=2; plural=(n!=1);");

Просмотреть файл

@ -25,5 +25,5 @@
"Loading your devices …" : "თქვენი მწყობილობების ჩატვირთვა …",
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Chrome-ი ერთადერთი ბრაუზერია რომელიც მხარს უჭერს U2F მოწყობილობებს. Firefox-ით U2F-ით სარგებლობისთვის საჭიროა დააყენოთ \"U2F-ს მხარდაჭერის დანამატი\".",
"U2F device successfully registered." : "U2F მოწყობილობა წარმატებით დარეგისტრირდა."
},"pluralForm" :"nplurals=1; plural=0;"
},"pluralForm" :"nplurals=2; plural=(n!=1);"
}

Просмотреть файл

@ -1,6 +1,7 @@
OC.L10N.register(
"twofactor_u2f",
{
"Unnamed device" : "Įrenginys be pavadinimo",
"Remove" : "Šalinti",
"Adding a new device …" : "Pridedamas naujas įrenginys …",
"Could not remove your U2F device" : "Nepavyko pašalinti jūsų U2F įrenginio",
@ -11,4 +12,4 @@ OC.L10N.register(
"Loading your devices …" : "Įkeliami jūsų įrenginiai …",
"U2F device successfully registered." : "U2F įrenginys sėkmingai užregistruotas."
},
"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);");
"nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);");

Просмотреть файл

@ -1,4 +1,5 @@
{ "translations": {
"Unnamed device" : "Įrenginys be pavadinimo",
"Remove" : "Šalinti",
"Adding a new device …" : "Pridedamas naujas įrenginys …",
"Could not remove your U2F device" : "Nepavyko pašalinti jūsų U2F įrenginio",
@ -8,5 +9,5 @@
"An error occurred. Please try again." : "Įvyko klaida. Prašome bandyti dar kartą.",
"Loading your devices …" : "Įkeliami jūsų įrenginiai …",
"U2F device successfully registered." : "U2F įrenginys sėkmingai užregistruotas."
},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"
},"pluralForm" :"nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);"
}

Просмотреть файл

@ -19,6 +19,8 @@ OC.L10N.register(
"U2F device" : "Dispositivo U2F",
"Authenticate with an U2F device" : "Autenticar com um dispositivo U2F",
"Two Factor U2F" : "Dois Fatores U2F",
"U2F two-factor provider" : "Provedor de dois fatores U2F",
"A two-factor provider for U2F devices" : "Um provedor de dois fatores para dispositivos U2F",
"Please plug in your U2F device and press the device button to authorize." : "Por favor, ligue o seu dispositivo U2F e pressione o botão do dispositivo para autorizar.",
"An error occurred. Please try again." : "Ocorreu um erro. Por favor, tente novamente.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Instale a extensão \"U2F Support\" no Firefox para usar U2F. Isso não é necessário no Chrome.",

Просмотреть файл

@ -17,6 +17,8 @@
"U2F device" : "Dispositivo U2F",
"Authenticate with an U2F device" : "Autenticar com um dispositivo U2F",
"Two Factor U2F" : "Dois Fatores U2F",
"U2F two-factor provider" : "Provedor de dois fatores U2F",
"A two-factor provider for U2F devices" : "Um provedor de dois fatores para dispositivos U2F",
"Please plug in your U2F device and press the device button to authorize." : "Por favor, ligue o seu dispositivo U2F e pressione o botão do dispositivo para autorizar.",
"An error occurred. Please try again." : "Ocorreu um erro. Por favor, tente novamente.",
"Install the \"U2F Support Add-on\" on Firefox to use U2F, this is not needed on Chrome." : "Instale a extensão \"U2F Support\" no Firefox para usar U2F. Isso não é necessário no Chrome.",

Просмотреть файл

@ -28,4 +28,4 @@ OC.L10N.register(
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Prehliadač Chrome je jedniný, ktorý podporuje U2F zariadenia. Pre použitie U2F zariadenia v prehliadači Firefox je potrebné nainštalovať doplnok \"U2F Support Add-on\".",
"U2F device successfully registered." : "Zariadenie U2F bolo úspešne zaregistrované."
},
"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;");
"nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);");

Просмотреть файл

@ -25,5 +25,5 @@
"Loading your devices …" : "Načítavanie vašich zariadení ...",
"Chrome is the only browser that supports U2F devices. You need to install the \"U2F Support Add-on\" on Firefox to use U2F." : "Prehliadač Chrome je jedniný, ktorý podporuje U2F zariadenia. Pre použitie U2F zariadenia v prehliadači Firefox je potrebné nainštalovať doplnok \"U2F Support Add-on\".",
"U2F device successfully registered." : "Zariadenie U2F bolo úspešne zaregistrované."
},"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"
},"pluralForm" :"nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);"
}

Просмотреть файл

@ -1,8 +1,10 @@
<?php
declare(strict_types = 1);
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* Two-factor U2F
*

Просмотреть файл

@ -1,8 +1,10 @@
<?php
declare(strict_types = 1);
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Copyright (c) 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* Two-factor U2F
*

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* Nextcloud - U2F 2FA
*
@ -7,7 +9,7 @@
* later. See the COPYING file.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Christoph Wurst 2016
* @copyright Christoph Wurst 2018
*/
namespace OCA\TwoFactorU2F\Controller;
@ -28,13 +30,7 @@ class SettingsController extends Controller {
/** @var IUserSession */
private $userSession;
/**
* @param string $appName
* @param IRequest $request
* @param U2FManager $manager
* @param IUserSession $userSession
*/
public function __construct($appName, IRequest $request, U2FManager $manager, IUserSession $userSession) {
public function __construct(string $appName, IRequest $request, U2FManager $manager, IUserSession $userSession) {
parent::__construct($appName, $request);
$this->manager = $manager;
$this->userSession = $userSession;
@ -42,22 +38,20 @@ class SettingsController extends Controller {
/**
* @NoAdminRequired
* @return JSONResponse
*/
public function state() {
return [
public function state(): JSONResponse {
return new JSONResponse([
'devices' => $this->manager->getDevices($this->userSession->getUser())
];
]);
}
/**
* @NoAdminRequired
* @PasswordConfirmationRequired
* @UseSession
* @return JSONResponse
*/
public function startRegister() {
return $this->manager->startRegistration($this->userSession->getUser());
public function startRegister(): JSONResponse {
return new JSONResponse($this->manager->startRegistration($this->userSession->getUser()));
}
/**
@ -67,10 +61,9 @@ class SettingsController extends Controller {
* @param string $registrationData
* @param string $clientData
* @param string|null $name device name, given by user
* @return JSONResponse
*/
public function finishRegister($registrationData, $clientData, $name = null) {
return $this->manager->finishRegistration($this->userSession->getUser(), $registrationData, $clientData, $name);
public function finishRegister(string $registrationData, string $clientData, string $name = null): JSONResponse {
return new JSONResponse($this->manager->finishRegistration($this->userSession->getUser(), $registrationData, $clientData, $name));
}
/**
@ -78,10 +71,9 @@ class SettingsController extends Controller {
* @PasswordConfirmationRequired
*
* @param int $id
* @return JSONResponse
*/
public function remove($id) {
return $this->manager->removeDevice($this->userSession->getUser(), $id);
public function remove(int $id): JSONResponse {
return new JSONResponse($this->manager->removeDevice($this->userSession->getUser(), $id));
}
}

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* Nextcloud - U2F 2FA
*
@ -7,7 +9,7 @@
* later. See the COPYING file.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Christoph Wurst 2016
* @copyright Christoph Wurst 2018
*/
namespace OCA\TwoFactorU2F\Db;
@ -38,7 +40,7 @@ class Registration extends Entity implements JsonSerializable {
protected $counter;
protected $name;
public function jsonSerialize() {
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* Nextcloud - U2F 2FA
*
@ -7,7 +9,7 @@
* later. See the COPYING file.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Christoph Wurst 2016
* @copyright Christoph Wurst 2018
*/
namespace OCA\TwoFactorU2F\Db;
@ -26,9 +28,8 @@ class RegistrationMapper extends Mapper {
/**
* @param IUser $user
* @param int $id
* @return Registration
*/
public function findRegistration(IUser $user, $id) {
public function findRegistration(IUser $user, $id): Registration {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();
@ -48,7 +49,7 @@ class RegistrationMapper extends Mapper {
* @param IUser $user
* @return Registration[]
*/
public function findRegistrations(IUser $user) {
public function findRegistrations(IUser $user): array {
/* @var $qb IQueryBuilder */
$qb = $this->db->getQueryBuilder();

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* Nextcloud - U2F 2FA
*
@ -7,7 +9,7 @@
* later. See the COPYING file.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Christoph Wurst 2016
* @copyright Christoph Wurst 2018
*/
namespace OCA\TwoFactorU2F\Provider;
@ -26,10 +28,6 @@ class U2FProvider implements IProvider {
/** @var U2FManager */
private $manager;
/**
* @param IL10N $l10n
* @param U2FManager $manager
*/
public function __construct(IL10N $l10n, U2FManager $manager) {
$this->l10n = $l10n;
$this->manager = $manager;
@ -37,38 +35,29 @@ class U2FProvider implements IProvider {
/**
* Get unique identifier of this 2FA provider
*
* @return string
*/
public function getId() {
public function getId(): string {
return 'u2f';
}
/**
* Get the display name for selecting the 2FA provider
*
* @return string
*/
public function getDisplayName() {
public function getDisplayName(): string {
return 'U2F device';
}
/**
* Get the description for selecting the 2FA provider
*
* @return string
*/
public function getDescription() {
public function getDescription(): string {
return $this->l10n->t('Authenticate with an U2F device');
}
/**
* Get the template for rending the 2FA provider view
*
* @param IUser $user
* @return Template
*/
public function getTemplate(IUser $user) {
public function getTemplate(IUser $user): Template {
$reqs = $this->manager->startAuthenticate($user);
$tmpl = new Template('twofactor_u2f', 'challenge');
@ -78,21 +67,15 @@ class U2FProvider implements IProvider {
/**
* Verify the given challenge
*
* @param IUser $user
* @param string $challenge
*/
public function verifyChallenge(IUser $user, $challenge) {
public function verifyChallenge(IUser $user, string $challenge): bool {
return $this->manager->finishAuthenticate($user, $challenge);
}
/**
* Decides whether 2FA is enabled for the given user
*
* @param IUser $user
* @return boolean
*/
public function isTwoFactorAuthEnabledForUser(IUser $user) {
public function isTwoFactorAuthEnabledForUser(IUser $user): bool {
return count($this->manager->getDevices($user)) > 0;
}

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* Nextcloud - U2F 2FA
*
@ -42,13 +44,6 @@ class U2FManager {
/** @var IManager */
private $activityManager;
/**
* @param RegistrationMapper $mapper
* @param ISession $session
* @param ILogger $logger
* @param IRequest $request
* @param IManager $activityManager
*/
public function __construct(RegistrationMapper $mapper, ISession $session, ILogger $logger, IRequest $request, IManager $activityManager) {
$this->mapper = $mapper;
$this->session = $session;
@ -57,12 +52,12 @@ class U2FManager {
$this->activityManager = $activityManager;
}
private function getU2f() {
private function getU2f(): U2F {
$url = $this->request->getServerProtocol() . '://' . $this->request->getServerHost();
return new U2F($url);
}
private function getRegistrations(IUser $user) {
private function getRegistrations(IUser $user): array {
$registrations = $this->mapper->findRegistrations($user);
$registrationObjects = array_map(function (Registration $registration) {
return (object) $registration->jsonSerialize();
@ -70,11 +65,7 @@ class U2FManager {
return $registrationObjects;
}
/**
* @param IUser $user
* @return array
*/
public function getDevices(IUser $user) {
public function getDevices(IUser $user): array {
$registrations = $this->mapper->findRegistrations($user);
return array_map(function(Registration $reg) {
return [
@ -84,21 +75,13 @@ class U2FManager {
}, $registrations);
}
/**
* @param IUser $user
* @param int $id device id
*/
public function removeDevice(IUser $user, $id) {
public function removeDevice(IUser $user, int $id) {
$reg = $this->mapper->findRegistration($user, $id);
$this->mapper->delete($reg);
$this->publishEvent($user, 'u2f_device_removed');
}
/**
* @param IUser $user
* @return array
*/
public function startRegistration(IUser $user) {
public function startRegistration(IUser $user): array {
$u2f = $this->getU2f();
$data = $u2f->getRegisterData($this->getRegistrations($user));
list($req, $sigs) = $data;
@ -114,13 +97,7 @@ class U2FManager {
];
}
/**
* @param IUser $user
* @param string $registrationData
* @param string $clientData
* @param string $name
*/
public function finishRegistration(IUser $user, $registrationData, $clientData, $name = null) {
public function finishRegistration(IUser $user, string $registrationData, string $clientData, string $name = null): array {
$this->logger->debug($registrationData);
$this->logger->debug($clientData);
@ -152,11 +129,8 @@ class U2FManager {
/**
* Push an U2F event the user's activity stream
*
* @param IUser $user
* @param string $event
*/
private function publishEvent(IUser $user, $event) {
private function publishEvent(IUser $user, string $event) {
$activity = $this->activityManager->generateEvent();
$activity->setApp('twofactor_u2f')
->setType('security')
@ -166,14 +140,14 @@ class U2FManager {
$this->activityManager->publish($activity);
}
public function startAuthenticate(IUser $user) {
public function startAuthenticate(IUser $user): array {
$u2f = $this->getU2f();
$reqs = $u2f->getAuthenticateData($this->getRegistrations($user));
$this->session->set('twofactor_u2f_authReq', json_encode($reqs));
return $reqs;
}
public function finishAuthenticate(IUser $user, $challenge) {
public function finishAuthenticate(IUser $user, string $challenge): bool {
$u2f = $this->getU2f();
$registrations = $this->getRegistrations($user);

Просмотреть файл

@ -1,5 +1,7 @@
<?php
declare(strict_types = 1);
/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
*
@ -29,21 +31,18 @@ class Personal implements ISettings {
/**
* @return TemplateResponse
*/
public function getForm() {
public function getForm(): TemplateResponse {
return new TemplateResponse('twofactor_u2f', 'personal');
}
/**
* @return string the section ID
*/
public function getSection() {
public function getSection(): string {
return 'security';
}
/**
* @return int
*/
public function getPriority() {
public function getPriority(): int {
return 40;
}

Просмотреть файл

@ -12,7 +12,7 @@ auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=false
auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_phpunit_2e_only=false
file.reference.twofactor_u2f-tests=tests
include.path=${php.global.include.path}
php.version=PHP_56
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false

7589
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -9,25 +9,25 @@
"dependencies": {
"es6-promise": "^4.2.4",
"handlebars": "^4.0.11",
"u2f-api": "^0.2.7"
"u2f-api": "^1.0.6"
},
"devDependencies": {
"backbone": "^1.3.3",
"coveralls": "^3.0.0",
"coveralls": "^3.0.1",
"jasmine": "^3.1.0",
"jasmine-ajax": "^3.3.1",
"jasmine-ajax": "^3.4.0",
"jasmine-core": "^3.1.0",
"jquery": "^3.3.1",
"karma": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.1.1",
"karma": "^2.0.2",
"karma-coverage": "^1.1.2",
"karma-jasmine": "^1.1.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.13",
"underscore": "^1.8.3",
"webpack": "^4.1.0",
"webpack-cli": "^2.0.10",
"karma-webpack": "^3.0.0",
"underscore": "^1.9.0",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3",
"webpack-merge": "^4.1.2"
},
"scripts": {

Просмотреть файл

@ -14,6 +14,7 @@ namespace OCA\TwoFactorU2F\Tests\Unit\Controller;
use OCA\TwoFactorU2F\Controller\SettingsController;
use OCA\TwoFactorU2F\Service\U2FManager;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserSession;
@ -64,10 +65,10 @@ class SettingsControllerTest extends TestCase {
->with($this->equalTo($user))
->willReturn($devices);
$expected = [
$expected = new JSONResponse([
'devices' => $devices,
];
$this->assertSame($expected, $this->controller->state());
]);
$this->assertEquals($expected, $this->controller->state());
}
public function testStartRegister() {
@ -81,7 +82,7 @@ class SettingsControllerTest extends TestCase {
->with($this->equalTo($user))
->willReturn([]);
$this->assertEquals([], $this->controller->startRegister());
$this->assertEquals(new JSONResponse([]), $this->controller->startRegister());
}
public function testFinishRegister() {
@ -94,9 +95,12 @@ class SettingsControllerTest extends TestCase {
$this->u2fManager->expects($this->once())
->method('finishRegistration')
->with($this->equalTo($user), $this->equalTo($registrationData), $this->equalTo($data));
->with($this->equalTo($user), $this->equalTo($registrationData), $this->equalTo($data))
->willReturn([]);
$this->controller->finishRegister($registrationData, $data);
$resp = $this->controller->finishRegister($registrationData, $data);
$this->assertEquals(new JSONResponse([]), $resp);
}
}

Просмотреть файл

@ -141,19 +141,4 @@ class U2FManagerTest extends TestCase {
$this->manager->startRegistration($user);
}
public function testFinishRegistration() {
// TODO: get a grasp of how the u2f lib works and feed it with
// realistic data or mock it.
}
public function testStartAuthenticate() {
// TODO: get a grasp of how the u2f lib works and feed it with
// realistic data or mock it.
}
public function testFinishAuthenticate() {
// TODO: get a grasp of how the u2f lib works and feed it with
// realistic data or mock it.
}
}