Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[devicelock] Add a singular plugin for all things device lock. Contri…
…butes to JB#34961
- Loading branch information
0 parents
commit 53b55d0
Showing
42 changed files
with
3,459 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Makefile | ||
*.o | ||
*.so* | ||
moc_* | ||
*.pc | ||
*.prl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TEMPLATE = subdirs | ||
|
||
SUBDIRS = \ | ||
src | ||
|
||
OTHER_FILES += \ | ||
rpm/nemo-qml-plugin-devicelock.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Name: nemo-qml-plugin-devicelock | ||
Summary: Device lock plugin for Nemo Mobile | ||
Version: 0.0.0 | ||
Release: 1 | ||
Group: System/Libraries | ||
License: LGPLv2.1 | ||
URL: https://git.merproject.org/mer-core/nemo-qml-plugin-dbus | ||
Source0: %{name}-%{version}.tar.bz2 | ||
BuildRequires: pkgconfig(Qt5DBus) | ||
BuildRequires: pkgconfig(Qt5Core) | ||
BuildRequires: pkgconfig(Qt5Network) | ||
BuildRequires: pkgconfig(Qt5Qml) | ||
BuildRequires: pkgconfig(keepalive) | ||
BuildRequires: pkgconfig(mce) | ||
BuildRequires: pkgconfig(mlite5) | ||
|
||
%description | ||
%{summary}. | ||
|
||
%package default | ||
Summary: The default lock code based device lock plugin for Nemo Mobile | ||
Group: System/GUI/Other | ||
Provides: nemo-qml-plugin-devicelock | ||
|
||
%description default | ||
%{summary}. | ||
|
||
%package devel | ||
Summary: Development libraries for device lock QML plugins | ||
Group: Development/Libraries | ||
|
||
%description devel | ||
%{summary}. | ||
|
||
%prep | ||
%setup -q -n %{name}-%{version} | ||
|
||
%build | ||
%qmake5 | ||
make %{?jobs:-j%jobs} | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
%qmake5_install | ||
|
||
%files default | ||
%defattr(-,root,root,-) | ||
%dir %{_libdir}/qt5/qml/org/nemomobile/devicelock | ||
%{_libdir}/qt5/qml/org/nemomobile/devicelock/libnemodevicelockplugin.so | ||
%{_libdir}/qt5/qml/org/nemomobile/devicelock/qmldir | ||
|
||
%files devel | ||
%{_includedir}/nemo-devicelock/authorization.h | ||
%{_includedir}/nemo-devicelock/authenticator.h | ||
%{_includedir}/nemo-devicelock/devicelock.h | ||
%{_includedir}/nemo-devicelock/devicelocksettings.h | ||
%{_includedir}/nemo-devicelock/devicereset.h | ||
%{_includedir}/nemo-devicelock/fingerprintsettings.h | ||
%{_includedir}/nemo-devicelock/lockcodesettings.h | ||
%{_includedir}/nemo-devicelock/nemoauthenticator.h | ||
%{_includedir}/nemo-devicelock/nemoauthorization.h | ||
%{_includedir}/nemo-devicelock/nemodevicelock.h | ||
%{_includedir}/nemo-devicelock/nemodevicelocksettings.h | ||
%{_includedir}/nemo-devicelock/nemodevicereset.h | ||
%{_includedir}/nemo-devicelock/nemofingerprintsettings.h | ||
%{_includedir}/nemo-devicelock/nemolockcodesettings.h | ||
%{_includedir}/nemo-devicelock/mcedevicelock.h | ||
%{_libdir}/libnemodevicelock.a | ||
%{_libdir}/pkgconfig/nemodevicelock.pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (C) 2016 Jolla Ltd | ||
* Contact: Andrew den Exter <andrew.den.exter@jolla.com> | ||
* | ||
* You may use this file under the terms of the BSD license as follows: | ||
* | ||
* "Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* * Neither the name of Nemo Mobile nor the names of its contributors | ||
* may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | ||
*/ | ||
|
||
#include "authenticator.h" | ||
#include "settingswatcher.h" | ||
|
||
Authenticator::Authenticator(QObject *parent) | ||
: QObject(parent) | ||
, m_settings(SettingsWatcher::instance()) | ||
{ | ||
connect(m_settings.data(), &SettingsWatcher::maximumAttemptsChanged, | ||
this, &Authenticator::maximumAttemptsChanged); | ||
connect(m_settings.data(), &SettingsWatcher::inputIsKeyboardChanged, | ||
this, &Authenticator::codeInputIsKeyboardChanged); | ||
} | ||
|
||
Authenticator::~Authenticator() | ||
{ | ||
} | ||
|
||
int Authenticator::minimumCodeLength() const | ||
{ | ||
return m_settings->minimumLength; | ||
} | ||
|
||
int Authenticator::maximumCodeLength() const | ||
{ | ||
return m_settings->maximumLength; | ||
} | ||
int Authenticator::maximumAttempts() const | ||
{ | ||
return m_settings->maximumAttempts; | ||
} | ||
|
||
bool Authenticator::codeInputIsKeyboard() const | ||
{ | ||
return m_settings->inputIsKeyboard; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Copyright (C) 2016 Jolla Ltd | ||
* Contact: Andrew den Exter <andrew.den.exter@jolla.com> | ||
* | ||
* You may use this file under the terms of the BSD license as follows: | ||
* | ||
* "Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* * Neither the name of Nemo Mobile nor the names of its contributors | ||
* may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | ||
*/ | ||
|
||
#ifndef AUTHENTICATOR_H | ||
#define AUTHENTICATOR_H | ||
|
||
#include <QObject> | ||
|
||
#include <QSharedDataPointer> | ||
|
||
class SettingsWatcher; | ||
|
||
class Authenticator : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(Methods availableMethods READ availableMethods NOTIFY availableMethodsChanged) | ||
Q_PROPERTY(Methods utilizedMethods READ utilizedMethods NOTIFY utilizedMethodsChanged) | ||
Q_PROPERTY(bool authenticating READ isAuthenticating NOTIFY authenticatingChanged) | ||
Q_PROPERTY(int minimumCodeLength READ minimumCodeLength CONSTANT) | ||
Q_PROPERTY(int maximumCodeLength READ maximumCodeLength CONSTANT) | ||
Q_PROPERTY(int maximumAttempts READ maximumAttempts NOTIFY maximumAttemptsChanged) | ||
Q_PROPERTY(bool codeInputIsKeyboard READ codeInputIsKeyboard NOTIFY codeInputIsKeyboardChanged) | ||
Q_ENUMS(Feedback) | ||
Q_ENUMS(Error) | ||
Q_ENUMS(Method) | ||
Q_FLAGS(Methods) | ||
public: | ||
enum Feedback { | ||
PartialPrint, | ||
PrintIsUnclear, | ||
SensorIsDirty, | ||
SwipeFaster, | ||
SwipeSlower, | ||
UnrecognizedFinger, | ||
IncorrectLockCode | ||
}; | ||
|
||
enum Error { | ||
LockedOut | ||
}; | ||
|
||
enum Method { | ||
NoAuthentication = 0x00, | ||
LockCode = 0x01, | ||
Fingerprint = 0x02 | ||
}; | ||
|
||
Q_DECLARE_FLAGS(Methods, Method) | ||
|
||
explicit Authenticator(QObject *parent = nullptr); | ||
~Authenticator(); | ||
|
||
virtual Methods availableMethods() const = 0; | ||
virtual Methods utilizedMethods() const = 0; | ||
virtual bool isAuthenticating() const = 0; | ||
|
||
int minimumCodeLength() const; | ||
int maximumCodeLength() const; | ||
int maximumAttempts() const; | ||
bool codeInputIsKeyboard() const; | ||
|
||
Q_INVOKABLE virtual void authenticate( | ||
const QVariant &challengeCode, Methods methods = Methods(LockCode | Fingerprint)) = 0; | ||
Q_INVOKABLE virtual void enterLockCode(const QString &code) = 0; | ||
Q_INVOKABLE virtual void cancel() = 0; | ||
|
||
signals: | ||
void availableMethodsChanged(); | ||
void utilizedMethodsChanged(); | ||
void authenticatingChanged(); | ||
void codeInputIsKeyboardChanged(); | ||
void maximumAttemptsChanged(); | ||
|
||
void authenticated(const QVariant &authenticationToken); | ||
void feedback(Feedback feedback, int attemptsRemaining); | ||
void error(Error error); | ||
|
||
private: | ||
QExplicitlySharedDataPointer<SettingsWatcher> m_settings; | ||
}; | ||
|
||
Q_DECLARE_OPERATORS_FOR_FLAGS(Authenticator::Methods) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2016 Jolla Ltd | ||
* Contact: Andrew den Exter <andrew.den.exter@jolla.com> | ||
* | ||
* You may use this file under the terms of the BSD license as follows: | ||
* | ||
* "Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* * Neither the name of Nemo Mobile nor the names of its contributors | ||
* may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | ||
*/ | ||
|
||
#include "authorization.h" | ||
|
||
Authorization::Authorization(QObject *parent) | ||
: QObject(parent) | ||
{ | ||
} | ||
|
||
Authorization::~Authorization() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (C) 2016 Jolla Ltd | ||
* Contact: Andrew den Exter <andrew.den.exter@jolla.com> | ||
* | ||
* You may use this file under the terms of the BSD license as follows: | ||
* | ||
* "Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* * Neither the name of Nemo Mobile nor the names of its contributors | ||
* may be used to endorse or promote products derived from this | ||
* software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." | ||
*/ | ||
|
||
#ifndef AUTHENTICATION_H | ||
#define AUTHENTICATION_H | ||
|
||
#include <authenticator.h> | ||
|
||
#include <QVariant> | ||
|
||
class Authorization : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_ENUMS(Status) | ||
Q_FLAGS(Authenticator::Methods) | ||
Q_PROPERTY(Authenticator::Methods allowedMethods READ allowedMethods CONSTANT) | ||
Q_PROPERTY(Status status READ status NOTIFY statusChanged) | ||
Q_PROPERTY(QVariant challengeCode READ challengeCode NOTIFY challengeCodeChanged) | ||
public: | ||
enum Status { | ||
NoChallenge, | ||
RequestingChallenge, | ||
ChallengeIssued | ||
}; | ||
|
||
explicit Authorization(QObject *parent = nullptr); | ||
~Authorization(); | ||
|
||
virtual Authenticator::Methods allowedMethods() const = 0; | ||
|
||
virtual Status status() const = 0; | ||
virtual QVariant challengeCode() const = 0; | ||
|
||
Q_INVOKABLE virtual void requestChallenge() = 0; | ||
Q_INVOKABLE virtual void relinquishChallenge() = 0; | ||
|
||
signals: | ||
void challengeIssued(); | ||
void challengeDeclined(); | ||
|
||
void statusChanged(); | ||
void challengeCodeChanged(); | ||
}; | ||
|
||
#endif | ||
|
Oops, something went wrong.