Skip to content
GitLab
Explore
Sign in
IA2
RAP
Compare revisions
e80c791f923df639d004e0059492eb31c3d8b93d to ccc488d324f8320211c5294120cac02f662a2256
Hide whitespace changes
Inline
Side-by-side
classes/datalayer/mysql/MySQLAccessTokenDAO.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
MySQLAccessTokenDAO
extends
BaseMySQLDAO
implements
AccessTokenDAO
{
...
...
classes/datalayer/mysql/MySQLJWKSDAO.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
MySQLJWKSDAO
extends
BaseMySQLDAO
implements
JWKSDAO
{
...
...
@@ -12,13 +18,16 @@ class MySQLJWKSDAO extends BaseMySQLDAO implements JWKSDAO {
$dbh
=
$this
->
getDBHandler
();
$query
=
"INSERT INTO rsa_keypairs(id, private_key, public_key, alg) VALUES (:id, :private_key, :public_key, :alg)"
;
$query
=
"INSERT INTO rsa_keypairs(id, private_key, public_key, alg
, creation_time
) VALUES (:id, :private_key, :public_key, :alg
, :creation_time
)"
;
$now
=
time
();
$stmt
=
$dbh
->
prepare
(
$query
);
$stmt
->
bindParam
(
':id'
,
$keyPair
->
keyId
);
$stmt
->
bindParam
(
':private_key'
,
$keyPair
->
privateKey
);
$stmt
->
bindParam
(
':public_key'
,
$keyPair
->
publicKey
);
$stmt
->
bindParam
(
':alg'
,
$keyPair
->
alg
);
$stmt
->
bindParam
(
':creation_time'
,
$now
);
$stmt
->
execute
();
...
...
@@ -85,48 +94,4 @@ class MySQLJWKSDAO extends BaseMySQLDAO implements JWKSDAO {
return
$keyPair
;
}
public
function
getAllPublicJWK
():
array
{
$dbh
=
$this
->
getDBHandler
();
$query
=
"SELECT `kid`, `key`, `url`, `update_time` FROM public_jwk"
;
$stmt
=
$dbh
->
prepare
(
$query
);
$stmt
->
execute
();
$keys
=
[];
foreach
(
$stmt
->
fetchAll
()
as
$row
)
{
array_push
(
$keys
,
$this
->
getPublicJWKFromResultRow
(
$row
));
}
return
$keys
;
}
private
function
getPublicJWKFromResultRow
(
$row
):
PublicJWK
{
$jwk
=
new
PublicJWK
();
$jwk
->
key
=
$row
[
'key'
];
$jwk
->
kid
=
$row
[
'kid'
];
$jwk
->
url
=
$row
[
'url'
];
$jwk
->
updateTime
=
$row
[
'update_time'
];
return
$jwk
;
}
public
function
updatePublicJWK
(
PublicJWK
$jwk
)
{
$dbh
=
$this
->
getDBHandler
();
$query
=
"INSERT INTO public_jwk(kid, `key`, `url`, update_time) VALUES (:kid, :key, :url, :update_time)"
.
" ON DUPLICATE KEY UPDATE `key`=:key, `url`=:url, update_time=:update_time"
;
$stmt
=
$dbh
->
prepare
(
$query
);
$stmt
->
bindParam
(
':kid'
,
$jwk
->
kid
);
$stmt
->
bindParam
(
':key'
,
$jwk
->
key
);
$stmt
->
bindParam
(
':url'
,
$jwk
->
url
);
$stmt
->
bindParam
(
':update_time'
,
$jwk
->
updateTime
);
$stmt
->
execute
();
}
}
classes/datalayer/mysql/MySQLRefreshTokenDAO.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
MySQLRefreshTokenDAO
extends
BaseMySQLDAO
implements
RefreshTokenDAO
{
...
...
classes/datalayer/mysql/MySQLUserDAO.php
View file @
ccc488d3
<?php
/* ----------------------------------------------------------------------------
* INAF - National Institute for Astrophysics
* IRA - Radioastronomical Institute - Bologna
* OATS - Astronomical Observatory - Trieste
* ----------------------------------------------------------------------------
*
/*
* This file is part of rap
* Copyright (C) 2016 Istituto Nazionale di Astrofisica
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License Version 3 as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
...
...
classes/exceptions/BadRequestException.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
BadRequestException
extends
\Exception
{
...
...
classes/exceptions/ServerErrorException.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
ServerErrorException
extends
\Exception
{
...
...
classes/exceptions/UnauthorizedException.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
UnauthorizedException
extends
\Exception
{
...
...
classes/login/FacebookLogin.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
FacebookLogin
extends
LoginHandler
{
...
...
classes/login/GmsClient.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
GmsClient
{
...
...
classes/login/GoogleLogin.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
GoogleLogin
extends
LoginHandler
{
...
...
classes/login/LinkedInLogin.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
LinkedInLogin
extends
LoginHandler
{
...
...
classes/login/LoginHandler.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
/**
...
...
classes/login/OrcidLogin.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
OrcidLogin
extends
LoginHandler
{
...
...
classes/login/ShibbolethLogin.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
ShibbolethLogin
extends
LoginHandler
{
...
...
@@ -17,8 +23,8 @@ class ShibbolethLogin extends LoginHandler {
// Search if the user is already registered into RAP using the eppn.
// The persistent id should be a more appropriate identifier, however at IA2
// we need to import all INAF user into RAP, even if they will never register,
// and in that case we
know only
their eppn.
// we need to import all INAF user
s
into RAP, even if they will never register,
// and in that case we
only know
their eppn.
$identity
=
new
Identity
(
Identity
::
EDU_GAIN
);
$identity
->
typedId
=
$eppn
;
$identity
->
email
=
$_SERVER
[
'mail'
];
...
...
classes/login/TestLogin.php
0 → 100644
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
TestLogin
extends
LoginHandler
{
private
$fakeIdentities
=
[];
public
function
__construct
(
Locator
$locator
)
{
parent
::
__construct
(
$locator
);
// Create fake identities
$this
->
fakeIdentities
[
1
]
=
$this
->
getFakeIdentity
(
Identity
::
EDU_GAIN
,
1
);
$this
->
fakeIdentities
[
2
]
=
$this
->
getFakeIdentity
(
Identity
::
GOOGLE
,
2
);
$this
->
fakeIdentities
[
3
]
=
$this
->
getFakeIdentity
(
Identity
::
LINKEDIN
,
3
);
}
public
function
login
():
string
{
return
$this
->
locator
->
getBasePath
()
.
'/auth/test/select'
;
}
public
function
retrieveToken
(
int
$id
):
string
{
return
$this
->
onIdentityDataReceived
(
$this
->
fakeIdentities
[
$id
]);
}
private
function
getFakeIdentity
(
string
$type
,
int
$i
):
Identity
{
$identity
=
new
Identity
(
$type
);
$identity
->
email
=
'fake-user'
.
$i
.
"@example.com"
;
$identity
->
eppn
=
$identity
->
email
;
$identity
->
typedId
=
'fake-user'
.
$i
;
return
$identity
;
}
}
classes/login/X509Login.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
class
X509Login
extends
LoginHandler
{
...
...
classes/model/AccessTokenData.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
/**
...
...
classes/model/AuthPageModel.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
/**
...
...
@@ -15,6 +21,7 @@ class AuthPageModel {
public
$facebook
;
public
$linkedIn
;
public
$localIdP
;
public
$test
;
//
public
$clientIcon
;
public
$clientTitle
;
...
...
@@ -58,6 +65,9 @@ class AuthPageModel {
$this
->
localIdP
=
isset
(
$config
->
authenticationMethods
->
LocalIdP
)
&&
in_array
(
AuthenticationMethods
::
LOCAL_IDP
,
$client
->
authMethods
);
$this
->
test
=
isset
(
$config
->
authenticationMethods
->
test
)
&&
$config
->
authenticationMethods
->
test
;
}
}
classes/model/AuthenticationMethods.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
abstract
class
AuthenticationMethods
{
...
...
classes/model/BrowserBasedClient.php
View file @
ccc488d3
<?php
/*
* This file is part of rap
* Copyright (C) 2021 Istituto Nazionale di Astrofisica
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace
RAP
;
/**
...
...
Prev
1
2
3
4
5
Next