Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Open
LU Authorization
Commits
a3f6363e
Commit
a3f6363e
authored
Feb 24, 2022
by
Dainis Abols
Browse files
Fixed notices, fixed missing configuration errors and removed dead code
Version 5.0.3
parent
5db4ecae
Changes
8
Hide whitespace changes
Inline
Side-by-side
Classes/Models/LDAP.php
View file @
a3f6363e
...
...
@@ -82,15 +82,15 @@ class LDAP
*/
public
function
authorize
(
$username
,
$password
)
{
if
(
@
ldap_bind
(
$this
->
conn
,
"uid=
{
$username
}
,
{
$this
->
dc
}
"
,
$password
))
{
if
(
ldap_bind
(
$this
->
conn
,
"uid=
{
$username
}
,
{
$this
->
dc
}
"
,
$password
))
{
if
(
$search
=
ldap_search
(
$this
->
conn
,
"uid=
{
$username
}
,
{
$this
->
dc
}
"
,
"(cn=*)"
))
{
$info
=
ldap_get_entries
(
$this
->
conn
,
$search
)[
0
];
$user
=
[
'username'
=>
$username
,
'display_name'
=>
$info
[
'displayname'
][
'0'
],
'email'
=>
$info
[
'mail'
][
'0'
],
'phone'
=>
$info
[
'telephonenumber'
][
'0'
],
'email'
=>
$info
[
'mail'
][
'0'
]
??
""
,
'phone'
=>
$info
[
'telephonenumber'
][
'0'
]
??
""
,
];
return
$user
;
...
...
Classes/Models/Server.php
View file @
a3f6363e
...
...
@@ -80,21 +80,22 @@ class Server
// Set config value
try
{
$this
->
conf
=
GeneralUtility
::
makeInstance
(
ExtensionConfiguration
::
class
)
->
get
(
'lu_auth'
);
}
catch
(
ExtensionConfigurationExtensionNotConfiguredException
|
ExtensionConfigurationPathDoesNotExistException
$e
)
{
}
catch
(
ExtensionConfigurationExtensionNotConfiguredException
|
ExtensionConfigurationPathDoesNotExistException
|
\
ArgumentCountError
$e
)
{
$this
->
logger
->
info
(
"Extension `lu_auth` not configured!"
);
}
// Set server variables
$this
->
remoteIdentityProvider
=
$_SERVER
[
$this
->
conf
[
'remoteIdentityProvider'
]]
?:
""
;
$this
->
remoteSessionId
=
$_SERVER
[
$this
->
conf
[
'remoteSessionId'
]]
?:
""
;
$this
->
remoteUser
=
$_SERVER
[
$this
->
conf
[
'remoteUser'
]]
?:
""
;
$this
->
remoteSessionId
=
$_SERVER
[
$this
->
conf
[
'remoteSessionId'
]]
?:
""
;
$this
->
remoteUser
=
$_SERVER
[
$this
->
conf
[
'remoteUser'
]]
?:
""
;
}
/**
* @param $OK
* @param $user
* @param $auth
* @param
$OK
* @param
$user
* @param
$auth
* @param false $log
*
* @return false|mixed
*/
public
function
checkDomainLock
(
$OK
,
$user
,
$auth
,
bool
$log
=
false
)
...
...
@@ -113,5 +114,5 @@ class Server
}
return
$OK
;
}
}
}
\ No newline at end of file
Tests/Functional/LDAPConnectionTest.php
View file @
a3f6363e
...
...
@@ -24,7 +24,7 @@ class LDAPConnectionTest extends UnitTestCase
*
* @var string
*/
private
$LocalConfiguration
=
'public/typo3conf/LocalConfiguration.php'
;
private
string
$LocalConfiguration
=
'public/typo3conf/LocalConfiguration.php'
;
/**
* Test connection
...
...
Tests/Unit/FEAuthorizationTest.php
deleted
100644 → 0
View file @
5db4ecae
<?php
declare
(
strict_types
=
1
);
namespace
Lu\LuAuth\Tests\Unit
;
use
Vendor\MyExtension\Service\AbstractSomethingService
;
use
TYPO3\TestingFramework\Core\Unit\UnitTestCase
;
/**
* Tests for Frontend authorization
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 21.02.2022
*/
class
FEAuthorizationTest
extends
UnitTestCase
{
public
function
initTest
()
{}
public
function
getUserTest
()
{}
public
function
authUserTest
()
{}
private
function
syncSingleUserDataTest
()
{}
private
function
setLogoutTest
()
{}
}
Tests/readme.me
deleted
100644 → 0
View file @
5db4ecae
Add to composer, when tests finished!
```
"autoload-dev": {
"psr-4": {
"Lu\\LuAuth\\Tests\\": "Tests"
}
},
```
\ No newline at end of file
composer.json
View file @
a3f6363e
{
"name"
:
"luitd/lu-auth"
,
"version"
:
"5.0.
2
"
,
"version"
:
"5.0.
3
"
,
"description"
:
"TYPO3 Authentication for University of Latvia"
,
"type"
:
"typo3-cms-extension"
,
"keywords"
:
[
...
...
ext_emconf.php
View file @
a3f6363e
...
...
@@ -14,7 +14,7 @@ $EM_CONF[$_EXTKEY] = [
'title'
=>
'LU Authentication'
,
'description'
=>
'TYPO3 Authentication for University of Latvia'
,
'category'
=>
'misc'
,
'version'
=>
'5.0.
2
'
,
'version'
=>
'5.0.
3
'
,
'dependencies'
=>
'typo3,lu_api'
,
'state'
=>
'stable'
,
'clearCacheOnLoad'
=>
1
,
...
...
readme.md
View file @
a3f6363e
...
...
@@ -3,7 +3,7 @@
## Version
5.
0.
2
5.
0.
3
## Dependencies
...
...
@@ -17,7 +17,7 @@ Dainis Abols <dainis.abols@lu.lv>
## Configuration
| Tab |
Var
name
| Meaning |
| Tab |
Test
name | Meaning |
|------------|------------------------|------------------------------|
| LDAP | ldapServer | LDAP Server |
| LDAP | ldapDC | LDAP Domain Component |
...
...
@@ -35,9 +35,8 @@ Dainis Abols <dainis.abols@lu.lv>
## Testing
```
shell
./vendor/bin/phpunit public/typo3conf/ext/lu_auth/Tests/<test-file>
./vendor/bin/phpunit public/typo3conf/ext/lu_auth/Tests
(
or
/<test-file>
)
```
| Test name | Test File | Assertions |
|----------------|--------------------------------|------------|
| connectionTest | Functional/LDAPConnection.php | 11 |
| Test File | Assertions |
|-----------------------------------|------------|
| Functional/LDAPConnectionTest.php | 11 |
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment