Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
11 / 11 |
CRAP | |
100.00% |
1 / 1 |
| AbstractSecondaryAuthenticationProvider | |
100.00% |
16 / 16 |
|
100.00% |
11 / 11 |
12 | |
100.00% |
1 / 1 |
| continueSecondaryAuthentication | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| postAuthentication | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| providerAllowsPropertyChange | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| providerRevokeAccessForUser | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |||
| providerAllowsAuthenticationDataChange | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| providerChangeAuthenticationData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testForAccountCreation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| continueSecondaryAccountCreation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| postAccountCreation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| testUserForCreation | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| autoCreatedAccount | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\Auth; |
| 8 | |
| 9 | /** |
| 10 | * A base class that implements some of the boilerplate for a SecondaryAuthenticationProvider |
| 11 | * |
| 12 | * @stable to extend |
| 13 | * @ingroup Auth |
| 14 | * @since 1.27 |
| 15 | */ |
| 16 | abstract class AbstractSecondaryAuthenticationProvider extends AbstractAuthenticationProvider |
| 17 | implements SecondaryAuthenticationProvider |
| 18 | { |
| 19 | |
| 20 | /** |
| 21 | * @inheritDoc |
| 22 | * @stable to override |
| 23 | */ |
| 24 | public function continueSecondaryAuthentication( $user, array $reqs ) { |
| 25 | throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @inheritDoc |
| 30 | * @stable to override |
| 31 | */ |
| 32 | public function postAuthentication( $user, AuthenticationResponse $response ) { |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * @inheritDoc |
| 37 | * @stable to override |
| 38 | */ |
| 39 | public function providerAllowsPropertyChange( $property ) { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @inheritDoc |
| 45 | * @stable to override |
| 46 | * @note Reimplement this if self::getAuthenticationRequests( AuthManager::ACTION_REMOVE ) |
| 47 | * doesn't return requests that will revoke all access for the user. |
| 48 | */ |
| 49 | public function providerRevokeAccessForUser( $username ) { |
| 50 | $reqs = $this->getAuthenticationRequests( |
| 51 | AuthManager::ACTION_REMOVE, [ 'username' => $username ] |
| 52 | ); |
| 53 | foreach ( $reqs as $req ) { |
| 54 | $req->username = $username; |
| 55 | $this->providerChangeAuthenticationData( $req ); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @inheritDoc |
| 61 | * @stable to override |
| 62 | */ |
| 63 | public function providerAllowsAuthenticationDataChange( |
| 64 | AuthenticationRequest $req, $checkData = true |
| 65 | ) { |
| 66 | return \StatusValue::newGood( 'ignored' ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @inheritDoc |
| 71 | * @stable to override |
| 72 | */ |
| 73 | public function providerChangeAuthenticationData( AuthenticationRequest $req ) { |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @inheritDoc |
| 78 | * @stable to override |
| 79 | */ |
| 80 | public function testForAccountCreation( $user, $creator, array $reqs ) { |
| 81 | return \StatusValue::newGood(); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @inheritDoc |
| 86 | * @stable to override |
| 87 | */ |
| 88 | public function continueSecondaryAccountCreation( $user, $creator, array $reqs ) { |
| 89 | throw new \BadMethodCallException( __METHOD__ . ' is not implemented.' ); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @inheritDoc |
| 94 | * @stable to override |
| 95 | */ |
| 96 | public function postAccountCreation( $user, $creator, AuthenticationResponse $response ) { |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @inheritDoc |
| 101 | * @stable to override |
| 102 | */ |
| 103 | public function testUserForCreation( $user, $autocreate, array $options = [] ) { |
| 104 | return \StatusValue::newGood(); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @inheritDoc |
| 109 | * @stable to override |
| 110 | */ |
| 111 | public function autoCreatedAccount( $user, $source ) { |
| 112 | } |
| 113 | } |