4
4
5
5
namespace Drupal \authman \AuthmanInstance ;
6
6
7
+ use Drupal \authman \AuthmanClock ;
7
8
use Drupal \authman \Entity \AuthmanAuthInterface ;
8
9
use Drupal \authman \EntityHandlers \AuthmanAuthStorage ;
9
10
use Drupal \authman \Exception \AuthmanClientCredentialsException ;
12
13
use Drupal \authman \Exception \AuthmanPluginException ;
13
14
use Drupal \authman \Plugin \KeyType \OauthKeyTypeInterface ;
14
15
use Drupal \authman \Token \AuthmanAccessToken ;
16
+ use Drupal \Component \Datetime \TimeInterface ;
15
17
use Drupal \Core \Entity \EntityStorageInterface ;
16
18
use Drupal \Core \Entity \EntityTypeManagerInterface ;
17
19
use Drupal \Core \Url ;
@@ -31,14 +33,24 @@ class AuthmanOauthFactory implements AuthmanOauthFactoryInterface {
31
33
*/
32
34
protected $ entityTypeManager ;
33
35
36
+ /**
37
+ * Time.
38
+ *
39
+ * @var \Drupal\Component\Datetime\TimeInterface
40
+ */
41
+ protected TimeInterface $ time ;
42
+
34
43
/**
35
44
* AuthmanOauthFactory constructor.
36
45
*
37
46
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
38
47
* The entity type manager.
48
+ * @param \Drupal\Component\Datetime\TimeInterface $time
49
+ * Time.
39
50
*/
40
- public function __construct (EntityTypeManagerInterface $ entityTypeManager ) {
51
+ public function __construct (EntityTypeManagerInterface $ entityTypeManager, TimeInterface $ time ) {
41
52
$ this ->entityTypeManager = $ entityTypeManager ;
53
+ $ this ->time = $ time ;
42
54
}
43
55
44
56
/**
@@ -50,9 +62,11 @@ public function get(string $id): AuthmanOauthInstanceInterface {
50
62
throw new \InvalidArgumentException ('Invalid ID ' );
51
63
}
52
64
65
+ $ clock = new AuthmanClock ($ this ->time );
53
66
$ redirectUri = Url::fromRoute ('authman.authorization_code.receive ' , ['authman_auth ' => $ authmanConfig ->id ()]);
54
67
$ providerOptions = [
55
68
'redirectUri ' => $ redirectUri ->setAbsolute ()->toString (TRUE )->getGeneratedUrl (),
69
+ 'clock ' => $ clock ,
56
70
];
57
71
58
72
$ clientKey = $ this ->keyStorage ()->load ($ authmanConfig ->getClientKeyId ());
0 commit comments