Skip to content

Commit b508173

Browse files
author
Martin Brecht-Precht
committedJan 18, 2021
Switched the root namespace and vendor prefix
1 parent 8069b78 commit b508173

21 files changed

+106
-102
lines changed
 

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Martin Brecht-Precht, Markenwerk GmbH
3+
Copyright (c) 2016 Martin Brecht-Precht, Chroma Experience GmbH
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# PHP Oath Server Suite
22

3-
[![Build Status](https://travis-ci.org/markenwerk/php-oath-server-suite.svg?branch=master)](https://travis-ci.org/markenwerk/php-oath-server-suite)
4-
[![Test Coverage](https://codeclimate.com/github/markenwerk/php-oath-server-suite/badges/coverage.svg)](https://codeclimate.com/github/markenwerk/php-oath-server-suite/coverage)
3+
[![Build Status](https://travis-ci.org/chroma-x/php-oath-server-suite.svg?branch=master)](https://travis-ci.org/chroma-x/php-oath-server-suite)
4+
[![Test Coverage](https://codeclimate.com/github/chroma-x/php-oath-server-suite/badges/coverage.svg)](https://codeclimate.com/github/chroma-x/php-oath-server-suite/coverage)
55
[![Dependency Status](https://www.versioneye.com/user/projects/571f771cfcd19a0045442330/badge.svg)](https://www.versioneye.com/user/projects/571f771cfcd19a0045442330)
66
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/8f5a3440-ec20-448b-b459-057eecbc5d4a.svg)](https://insight.sensiolabs.com/projects/8f5a3440-ec20-448b-b459-057eecbc5d4a)
7-
[![Code Climate](https://codeclimate.com/github/markenwerk/php-oath-server-suite/badges/gpa.svg)](https://codeclimate.com/github/markenwerk/php-oath-server-suite)
8-
[![Latest Stable Version](https://poser.pugx.org/markenwerk/oath-server-suite/v/stable)](https://packagist.org/packages/markenwerk/oath-server-suite)
9-
[![Total Downloads](https://poser.pugx.org/markenwerk/oath-server-suite/downloads)](https://packagist.org/packages/markenwerk/oath-server-suite)
10-
[![License](https://poser.pugx.org/markenwerk/oath-server-suite/license)](https://packagist.org/packages/markenwerk/oath-server-suite)
7+
[![Code Climate](https://codeclimate.com/github/chroma-x/php-oath-server-suite/badges/gpa.svg)](https://codeclimate.com/github/chroma-x/php-oath-server-suite)
8+
[![Latest Stable Version](https://poser.pugx.org/chroma-x/oath-server-suite/v/stable)](https://packagist.org/packages/chroma-x/oath-server-suite)
9+
[![Total Downloads](https://poser.pugx.org/chroma-x/oath-server-suite/downloads)](https://packagist.org/packages/chroma-x/oath-server-suite)
10+
[![License](https://poser.pugx.org/chroma-x/oath-server-suite/license)](https://packagist.org/packages/chroma-x/oath-server-suite)
1111

1212
A collection of classes to provide second factor authentication like Yubico OTP (Yubikey), Oath (TOTP, HOTP, GoogleAuthenticator) server-side.
1313

@@ -24,7 +24,7 @@ For more information about the Yubico OTP authentication mechanism read the „W
2424
```{json}
2525
{
2626
"require": {
27-
"markenwerk/oath-server-suite": "~4.0"
27+
"chroma-x/oath-server-suite": "~4.0"
2828
}
2929
}
3030
```
@@ -46,7 +46,7 @@ To use Yubico OTP you need YubiCloud access. You can get free API credentials fr
4646
#### Validating a Yubico one time password
4747

4848
```{php}
49-
use Markenwerk\CommonException\NetworkException\Base\NetworkException;
49+
use ChromaX\CommonException\NetworkException\Base\NetworkException;
5050
5151
$otp = $_POST['otp'];
5252
$userPublicId = 'fetchedFromDatabaseOrSimilar';
@@ -77,9 +77,9 @@ To allow authentication the client and server has to share a secret. Usually the
7777
##### TOTP (Time-based One-time Password Algorithm)
7878

7979
```{php}
80-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
81-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\TotpBase32SharedSecretUrlEncoder;
82-
use Markenwerk\QrCodeSuite\QrEncode\QrEncoder;
80+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
81+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\TotpBase32SharedSecretUrlEncoder;
82+
use ChromaX\QrCodeSuite\QrEncode\QrEncoder;
8383
8484
// Initialize Oath URL encoder for TOTP (Time-based One-time Password Algorithm)
8585
$contentEncoder = new TotpBase32SharedSecretUrlEncoder();
@@ -114,9 +114,9 @@ $sharedSecretQrProvider->provideQrCode('/path/to/the/qrcode.png');
114114
##### HOTP (HMAC-based One-time Password Algorithm)
115115

116116
```{php}
117-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
118-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\HotpBase32SharedSecretUrlEncoder;
119-
use Markenwerk\QrCodeSuite\QrEncode\QrEncoder;
117+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
118+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\HotpBase32SharedSecretUrlEncoder;
119+
use ChromaX\QrCodeSuite\QrEncode\QrEncoder;
120120
121121
// Initialize Oath URL encoder for HOTP (HMAC-based One-time Password Algorithm)
122122
$contentEncoder = new HotpBase32SharedSecretUrlEncoder();
@@ -190,9 +190,9 @@ if ($validator->isValid()) {
190190
##### TOTP (Time-based One-time Password Algorithm)
191191

192192
```{php}
193-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
194-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\TotpSharedSecretUrlEncoder;
195-
use Markenwerk\QrCodeSuite\QrEncode\QrEncoder;
193+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
194+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\TotpSharedSecretUrlEncoder;
195+
use ChromaX\QrCodeSuite\QrEncode\QrEncoder;
196196
197197
// Initialize Oath URL encoder for TOTP (Time-based One-time Password Algorithm)
198198
$contentEncoder = new TotpSharedSecretUrlEncoder();
@@ -227,9 +227,9 @@ $sharedSecretQrProvider->provideQrCode('/path/to/the/qrcode.png');
227227
##### HOTP (HMAC-based One-time Password Algorithm)
228228

229229
```{php}
230-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
231-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\HotpSharedSecretUrlEncoder;
232-
use Markenwerk\QrCodeSuite\QrEncode\QrEncoder;
230+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider\SharedSecretQrCodeProvider;
231+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\HotpSharedSecretUrlEncoder;
232+
use ChromaX\QrCodeSuite\QrEncode\QrEncoder;
233233
234234
// Initialize Oath URL encoder for HOTP (HMAC-based One-time Password Algorithm)
235235
$contentEncoder = new HotpSharedSecretUrlEncoder();
@@ -299,14 +299,14 @@ if ($validator->isValid()) {
299299
## Exception handling
300300

301301
PHP Oath Server Suite provides different exceptions – some provided by the PHP Common Exceptions project – for proper handling.
302-
You can find more information about [PHP Common Exceptions at Github](https://github.com/markenwerk/php-common-exceptions).
302+
You can find more information about [PHP Common Exceptions at Github](https://github.com/chroma-x/php-common-exceptions).
303303

304304
---
305305

306306
## Contribution
307307

308308
Contributing to our projects is always very appreciated.
309-
**But: please follow the contribution guidelines written down in the [CONTRIBUTING.md](https://github.com/markenwerk/php-oath-server-suite/blob/master/CONTRIBUTING.md) document.**
309+
**But: please follow the contribution guidelines written down in the [CONTRIBUTING.md](https://github.com/chroma-x/php-oath-server-suite/blob/master/CONTRIBUTING.md) document.**
310310

311311
## License
312312

‎composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "markenwerk/oath-server-suite",
2+
"name": "chroma-x/oath-server-suite",
33
"type": "library",
44
"description": "A collection of classes to provide second factor authentication like Yubico OTP (Yubikey), Oath (TOTP, HOTP, GoogleAuthenticator) server-side.",
55
"keywords": [
@@ -11,25 +11,25 @@
1111
"yubico",
1212
"google authenticator"
1313
],
14-
"homepage": "http://markenwerk.net/",
14+
"homepage": "http://chroma-x.de/",
1515
"license": "MIT",
1616
"authors": [
1717
{
1818
"name": "Martin Brecht-Precht",
19-
"email": "mb@markenwerk.net",
20-
"homepage": "http://markenwerk.net"
19+
"email": "mb@chroma-x.de",
20+
"homepage": "http://chroma-x.de"
2121
}
2222
],
2323
"autoload": {
2424
"psr-4": {
25-
"Markenwerk\\OathServerSuite\\": "src/"
25+
"ChromaX\\OathServerSuite\\": "src/"
2626
}
2727
},
2828
"require": {
2929
"php": ">=5.3",
3030
"lib-curl": "*",
31-
"markenwerk/common-exceptions": "~3.0",
32-
"markenwerk/qr-code-suite": "~4.0",
31+
"chroma-x/common-exceptions": "~3.0",
32+
"chroma-x/qr-code-suite": "~4.0",
3333
"enygma/yubikey": "~3.0",
3434
"skleeschulte/base32": "*"
3535
},

‎src/Exception/ParserException.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Exception;
3+
namespace ChromaX\OathServerSuite\Exception;
4+
5+
use Exception;
46

57
/**
68
* Class ParserException
79
*
8-
* @package Markenwerk\OathServerSuite\Exception
10+
* @package ChromaX\OathServerSuite\Exception
911
*/
10-
class ParserException extends \Exception
12+
class ParserException extends Exception
1113
{
1214

1315
}
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Exception;
3+
namespace ChromaX\OathServerSuite\Exception;
4+
5+
use Exception;
46

57
/**
68
* Class ValidationFailedException
79
*
8-
* @package Markenwerk\OathServerSuite\Exception
10+
* @package ChromaX\OathServerSuite\Exception
911
*/
10-
class ValidationFailedException extends \Exception
12+
class ValidationFailedException extends Exception
1113
{
1214

1315
}

‎src/SecretSharing/SharedSecretQrCodeProvider/SharedSecretQrCodeProvider.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretQrCodeProvider;
44

5-
use Markenwerk\QrCodeSuite\QrEncode\QrCode\QrCode;
6-
use Markenwerk\QrCodeSuite\QrEncode\QrEncoder;
7-
use Markenwerk\QrCodeSuite\QrRender\QrCodeRendererPng;
8-
use Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\Base\SharedSecretUrlEncoderInterface;
5+
use ChromaX\QrCodeSuite\QrEncode\QrCode\QrCode;
6+
use ChromaX\QrCodeSuite\QrEncode\QrEncoder;
7+
use ChromaX\QrCodeSuite\QrRender\QrCodeRendererPng;
8+
use ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\Base\SharedSecretUrlEncoderInterface;
99

1010
/**
1111
* Class SharedSecretQrCodeProvider
1212
*
13-
* @package Markenwerk\OathServerSuite\SharedSecretQrCodeProvider
13+
* @package ChromaX\OathServerSuite\SharedSecretQrCodeProvider
1414
*/
1515
class SharedSecretQrCodeProvider
1616
{

‎src/SecretSharing/SharedSecretUrlEncoder/Base/SharedSecretUrlEncoderInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\Base;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder\Base;
44

55
/**
66
* Interface SharedSecretUrlEncoderInterface
77
*
8-
* @package Markenwerk\OathServerSuite\SharedSecretUrlEncoder\Base
8+
* @package ChromaX\OathServerSuite\SharedSecretUrlEncoder\Base
99
*/
1010
interface SharedSecretUrlEncoderInterface
1111
{

‎src/SecretSharing/SharedSecretUrlEncoder/HotpBase32SharedSecretUrlEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
44

55
use SKleeschulte\Base32;
66

77
/**
88
* Class HotpBase32SharedSecretUrlEncoder
99
*
10-
* @package Markenwerk\OathServerSuite\SharedSecretUrlEncoder
10+
* @package ChromaX\OathServerSuite\SharedSecretUrlEncoder
1111
*/
1212
class HotpBase32SharedSecretUrlEncoder implements Base\SharedSecretUrlEncoderInterface
1313
{

‎src/SecretSharing/SharedSecretUrlEncoder/HotpSharedSecretUrlEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
44

55
/**
66
* Class HotpSharedSecretUrlEncoder
77
*
8-
* @package Markenwerk\OathServerSuite\SharedSecretUrlEncoder
8+
* @package ChromaX\OathServerSuite\SharedSecretUrlEncoder
99
*/
1010
class HotpSharedSecretUrlEncoder implements Base\SharedSecretUrlEncoderInterface
1111
{

‎src/SecretSharing/SharedSecretUrlEncoder/TotpBase32SharedSecretUrlEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
44

55
use SKleeschulte\Base32;
66

77
/**
88
* Class TotpBase32SharedSecretUrlEncoder
99
*
10-
* @package Markenwerk\OathServerSuite\SharedSecretUrlEncoder
10+
* @package ChromaX\OathServerSuite\SharedSecretUrlEncoder
1111
*/
1212
class TotpBase32SharedSecretUrlEncoder implements Base\SharedSecretUrlEncoderInterface
1313
{

‎src/SecretSharing/SharedSecretUrlEncoder/TotpSharedSecretUrlEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
3+
namespace ChromaX\OathServerSuite\SecretSharing\SharedSecretUrlEncoder;
44

55
/**
66
* Class TotpSharedSecretUrlEncoder
77
*
8-
* @package Markenwerk\OathServerSuite\SharedSecretUrlEncoder
8+
* @package ChromaX\OathServerSuite\SharedSecretUrlEncoder
99
*/
1010
class TotpSharedSecretUrlEncoder implements Base\SharedSecretUrlEncoderInterface
1111
{

‎src/Validation/Oath/Base/OathBaseValidator.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Validation\Oath\Base;
3+
namespace ChromaX\OathServerSuite\Validation\Oath\Base;
44

55
/**
66
* Class OathValidator
77
*
8-
* @package Markenwerk\OathServerSuite\Validation\Oath\Base
8+
* @package ChromaX\OathServerSuite\Validation\Oath\Base
99
*/
1010
abstract class OathBaseValidator
1111
{
@@ -33,7 +33,7 @@ public function getPasswordLength()
3333
protected function calculateValidHotp($sharedSecret, $counter)
3434
{
3535
$hmacHash = $this->hashHmac($sharedSecret, $counter);
36-
$hmacHashTruncated = $this->truncateHash($hmacHash, $this->passwordLength);
36+
$hmacHashTruncated = self::truncateHash($hmacHash, $this->passwordLength);
3737
return str_pad($hmacHashTruncated, $this->passwordLength, '0', STR_PAD_LEFT);
3838
}
3939

@@ -45,8 +45,7 @@ protected function calculateValidHotp($sharedSecret, $counter)
4545
private function hashHmac($secret, $counter)
4646
{
4747
$binCounter = pack('N*', 0) . pack('N*', $counter);
48-
$hash = hash_hmac('sha1', $binCounter, $secret, true);
49-
return $hash;
48+
return hash_hmac('sha1', $binCounter, $secret, true);
5049
}
5150

5251
/**

‎src/Validation/Oath/HotpValidator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Validation\Oath;
3+
namespace ChromaX\OathServerSuite\Validation\Oath;
44

55
/**
66
* Class HotpValidator
77
*
8-
* @package Markenwerk\OathServerSuite\Validation\Oath
8+
* @package ChromaX\OathServerSuite\Validation\Oath
99
*/
1010
class HotpValidator extends Base\OathBaseValidator
1111
{

‎src/Validation/Oath/TotpValidator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Validation\Oath;
3+
namespace ChromaX\OathServerSuite\Validation\Oath;
44

55
/**
66
* Class TotpValidator
77
*
8-
* @package Markenwerk\OathServerSuite\Validation\Oath
8+
* @package ChromaX\OathServerSuite\Validation\Oath
99
*/
1010
class TotpValidator extends Base\OathBaseValidator
1111
{

‎src/Validation/YubicoOtp/Parser.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Validation\YubicoOtp;
3+
namespace ChromaX\OathServerSuite\Validation\YubicoOtp;
44

5-
use Markenwerk\OathServerSuite\Exception\ParserException;
5+
use ChromaX\OathServerSuite\Exception\ParserException;
66

77
/**
88
* Class Parser
99
*
1010
* Based on the official [YubiCloud PHP client](https://github.com/Yubico/yubico-php-client/blob/master/YubiCloud.php)
1111
*
12-
* @package Markenwerk\OathServerSuite\YubicoOtp
12+
* @package ChromaX\OathServerSuite\YubicoOtp
1313
*/
1414
class Parser
1515
{

‎src/Validation/YubicoOtp/Validator.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22

3-
namespace Markenwerk\OathServerSuite\Validation\YubicoOtp;
3+
namespace ChromaX\OathServerSuite\Validation\YubicoOtp;
44

5-
use Markenwerk\CommonException\NetworkException\Base\NetworkException;
6-
use Markenwerk\OathServerSuite\Exception\ParserException;
5+
use ChromaX\CommonException\NetworkException\Base\NetworkException;
6+
use ChromaX\OathServerSuite\Exception\ParserException;
7+
use Exception;
78
use Yubikey\Validate;
89

910
/**
1011
* Class Validator
1112
*
12-
* @package Markenwerk\OathServerSuite\YubicoOtp
13+
* @package ChromaX\OathServerSuite\YubicoOtp
1314
*/
1415
class Validator
1516
{
@@ -70,7 +71,7 @@ public function validate($otp, $publicId)
7071
try {
7172
$yubicoApi = new Validate($this->yubiCloudSecretKey, $this->yubiCloudClientId);
7273
$response = $yubicoApi->check($otp);
73-
} catch (\Exception $exception) {
74+
} catch (Exception $exception) {
7475
throw new NetworkException('YubiCloud webservice access failed.', 0, $exception);
7576
}
7677
$this->valid = $response->success();

0 commit comments

Comments
 (0)
Please sign in to comment.