-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSeeder.php
More file actions
executable file
·1261 lines (1166 loc) · 55.2 KB
/
TestSeeder.php
File metadata and controls
executable file
·1261 lines (1166 loc) · 55.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php namespace Database\Seeders;
/**
* Copyright 2015 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use App\Models\OAuth2\Factories\ApiFactory;
use App\Models\OAuth2\Factories\ApiScopeFactory;
use App\Models\OAuth2\Factories\ResourceServerFactory;
use Illuminate\Support\Facades\Config;
use models\exceptions\EntityNotFoundException;
use Models\OAuth2\Api;
use OAuth2\Models\IClient;
use OAuth2\OAuth2Protocol;
use Auth\User;
use Utils\Services\IAuthService;
use Models\OAuth2\Client;
use Models\OAuth2\ResourceServer;
use Models\OAuth2\ApiScope;
use \jwk\JSONWebKeyPublicKeyUseValues;
use \jwk\JSONWebKeyTypes;
use \jwa\JSONWebSignatureAndEncryptionAlgorithms;
use Illuminate\Database\Seeder;
use Models\OAuth2\ClientPublicKey;
use Models\OAuth2\ServerPrivateKey;
use LaravelDoctrine\ORM\Facades\EntityManager;
use App\libs\Auth\Factories\UserFactory;
use App\libs\Auth\Factories\GroupFactory;
use OAuth2\Models\IOAuth2User;
use OpenId\Models\IOpenIdUser;
use Auth\Group;
use App\Models\OAuth2\Factories\ClientFactory;
use App\Models\OpenId\Factories\OpenIdTrustedSiteFactory;
use App\libs\Auth\Models\IGroupSlugs;
use Illuminate\Support\Facades\DB;
use DateTimeZone;
use TestKeys;
/**
* Class OAuth2ApplicationSeeder
* This seeder is only for testing purposes
*/
final class TestSeeder extends Seeder {
static $client_private_key_1 = <<<PPK
-----BEGIN RSA PRIVATE KEY-----
MIIJJwIBAAKCAgEAkjiUI6n3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OpGBqbnGBXgWF2rnbD0GYL1Sd3OSrgTHG3WrG95UizOcV9uijI8vWxczVl
P7sriaY7Xetcbh+Z5AbAf9TMOuccRFaM/KlovR7sOcQDO1NzqlL/PRzCfzcNId22
Q6uV3QE2hzRKfd+lKI1YmFrVJ0SnWlSdeX7kkWn/+eQ4WfkK9hmv4/0bzQYo1XCo
pEpjefZoWiErCAt4nEt2wr6f6BmSjTGVajGlhn7q8wwBBHfjAUfCgIAk8uGNGWke
gvytTYywLnyNEF8tHcdg+We+W6itqJ5bQNFHa9uxX+haURoTOcGqxN8n2LPcLoLU
7xqZY23wpeXO7anzqheGSQUHb56rWqcCRQ9jF/1RLCyyVd9eOEZF6Ke53qpLQxib
hqnZfba0zOKqhbxod6RSOswSF3wwHoIj+6SRNKgui4DDcMMc+bsndr/KUDxaYpiu
In2KVE6kd5a0t8BHgdu/yQIDAQAB
-----END PUBLIC KEY-----
PPK;
private function createTestGroups(){
$groups_payloads = [
[
'name' => IOAuth2User::OAuth2ServerAdminGroup,
'slug' => IOAuth2User::OAuth2ServerAdminGroup,
],
[
'name' => IOAuth2User::OAuth2SystemScopeAdminGroup,
'slug' => IOAuth2User::OAuth2SystemScopeAdminGroup,
],
[
'name' => IOpenIdUser::OpenIdServerAdminGroup,
'slug' => IOpenIdUser::OpenIdServerAdminGroup,
],
[
'name' => IGroupSlugs::SuperAdminGroup,
'slug' => IGroupSlugs::SuperAdminGroup,
],
[
'name' => IGroupSlugs::RawUsersGroup,
'slug' => IGroupSlugs::RawUsersGroup,
],
[
'name' => IGroupSlugs::SponsorServicesGroup,
'slug' => IGroupSlugs::SponsorServicesGroup,
],
[
'name' => IGroupSlugs::SponsorUsersGroup,
'slug' => IGroupSlugs::SponsorUsersGroup,
],
[
'name' => IGroupSlugs::SponsorExternalUsersGroup,
'slug' => IGroupSlugs::SponsorExternalUsersGroup,
]
];
foreach ($groups_payloads as $payload){
$group = GroupFactory::build($payload);
EntityManager::persist($group);
}
EntityManager::flush();
}
private function createTestUsers(){
$group_repository = EntityManager::getRepository(Group::class);
$oauth2_admin_group = $group_repository->findOneBy(['slug' => IOAuth2User::OAuth2ServerAdminGroup]);
$opendid_admin_group = $group_repository->findOneBy(['slug' => IOpenIdUser::OpenIdServerAdminGroup,]);
$system_scopes_admin_group = $group_repository->findOneBy(['slug' => IOAuth2User::OAuth2SystemScopeAdminGroup]);
$super_admin_group = $group_repository->findOneBy(['slug' => IGroupSlugs::SuperAdminGroup]);
$raw_users_group = $group_repository->findOneBy(['slug' => IGroupSlugs::RawUsersGroup]);
$user_payloads = [
[
'first_name' => 'Sebastian',
'last_name' => 'Marcet',
'email' => 'sebastian@tipit.net',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => 'sebastian.marcet',
],
[
'first_name' => 'Sebastian',
'last_name' => 'Marcet IDN',
'email' => 'hei@やる.ca',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => 'hei@やる',
],
[
'first_name' => 'Márton',
'last_name' => 'Kiss',
'email' => 'mkiss@tipit.net',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => '2',
],
[
'first_name' => '付',
'last_name' => '金刚',
'email' => 'fujg573@tipit.net',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => '3',
],
[
'first_name' => 'Bharath',
'last_name' => 'Kumar M R',
'email' => 'mrbharathee@tipit.net',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => '4',
],
[
'first_name' => '大塚',
'last_name' => '元央',
'email' => 'yuanying@tipit.net',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => '5',
],
[
'first_name' => 'Ian Y.',
'last_name' => 'Choi',
'email' => 'ianyrchoi@gmail.com',
'password' => '1Qaz2wsx!',
'password_enc' => \Auth\AuthHelper::AlgSHA1_V2_4,
'gender' => 'male',
'address1' => 'Av. Siempre Viva 111',
'address2' => 'Av. Siempre Viva 111',
'city' => 'Lanus Este',
'state' => 'Buenos Aires',
'post_code' => '1824',
'country' => 'AR',
'language' => 'ESP',
'active' => true,
'email_verified' => true,
'groups' => [
$super_admin_group
],
'identifier' => '6',
]
];
foreach ($user_payloads as $payload){
$user = UserFactory::build($payload);
if (isset($payload['groups'])) {
foreach ($payload['groups'] as $group) {
$user->addToGroup($group);
}
}
EntityManager::persist($user);
$raw_password = $payload['password'];
if(!$user->checkPassword($raw_password))
throw new \Exception("password verification failed !!!");
}
EntityManager::flush();
}
public function run()
{
DB::table('banned_ips')->delete();
DB::table('user_exceptions_trail')->delete();
DB::table('server_configuration')->delete();
DB::table('server_extensions')->delete();
DB::table('oauth2_client_api_scope')->delete();
DB::table('oauth2_client_authorized_uri')->delete();
DB::table('oauth2_access_token')->delete();
DB::table('oauth2_refresh_token')->delete();
DB::table('oauth2_asymmetric_keys')->delete();
DB::table('oauth2_client')->delete();
DB::table('openid_trusted_sites')->delete();
DB::table('openid_associations')->delete();
DB::table('user_actions')->delete();
DB::table('user_groups')->delete();
DB::table('user_password_reset_request')->delete();
DB::table('oauth2_otp')->delete();
DB::table('users')->delete();
DB::table('groups')->delete();
DB::table('oauth2_api_endpoint_api_scope')->delete();
DB::table('oauth2_api_endpoint')->delete();
DB::table('oauth2_api_scope')->delete();
DB::table('oauth2_api')->delete();
DB::table('oauth2_resource_server')->delete();
$this->createTestGroups();
$this->createTestUsers();
$this->call(OpenIdExtensionsSeeder::class);
$this->call(ServerConfigurationSeeder::class);
$this->call(ResourceServerSeeder::class);
$this->call(ApiSeeder::class);
$this->call(ApiScopeSeeder::class);
$this->call(ApiEndpointSeeder::class);
$this->seedTestResourceServers();
$this->seedApis();
$this->seedResourceServerScopes();
$this->seedApiScopes();
$this->seedApiEndpointScopes();
$this->seedApiScopeScopes();
$this->seedGroupScopes();
$this->seedTestApiEndpoints();
// clients
$this->seedTestUsersAndClients();
}
private function seedResourceServerScopes(){
$api_repository = EntityManager::getRepository(Api::class);
$resource_server = $api_repository->findOneBy(['name' => 'resource-server']);
$current_realm = Config::get('app.url');
$api_scope_payloads = [
array(
'name' => sprintf('%s/resource-server/read',$current_realm),
'short_description' => 'Resource Server Read Access',
'description' => 'Resource Server Read Access',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/read.page',$current_realm),
'short_description' => 'Resource Server Page Read Access',
'description' => 'Resource Server Page Read Access',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/write',$current_realm),
'short_description' => 'Resource Server Write Access',
'description' => 'Resource Server Write Access',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/delete',$current_realm),
'short_description' => 'Resource Server Delete Access',
'description' => 'Resource Server Delete Access',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/update',$current_realm),
'short_description' => 'Resource Server Update Access',
'description' => 'Resource Server Update Access',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/update.status',$current_realm),
'short_description' => 'Resource Server Update Status',
'description' => 'Resource Server Update Status',
'api' => $resource_server,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/resource-server/regenerate.secret',$current_realm),
'short_description' => 'Resource Server Regenerate Client Secret',
'description' => 'Resource Server Regenerate Client Secret',
'api' => $resource_server,
'system' => true,
'active' => true,
)
];
foreach($api_scope_payloads as $payload) {
EntityManager::persist(ApiScopeFactory::build($payload));
}
EntityManager::flush();
}
private function seedApiEndpointScopes(){
$api_repository = EntityManager::getRepository(Api::class);
$api_endpoint = $api_repository->findOneBy(['name' => 'api-endpoint']);
$current_realm = Config::get('app.url');
$api_scope_payloads = [
array(
'name' => sprintf('%s/api-endpoint/read',$current_realm),
'short_description' => 'Get Api Endpoint',
'description' => 'Get Api Endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/delete',$current_realm),
'short_description' => 'Deletes Api Endpoint',
'description' => 'Deletes Api Endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/write',$current_realm),
'short_description' => 'Create Api Endpoint',
'description' => 'Create Api Endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/update',$current_realm),
'short_description' => 'Update Api Endpoint',
'description' => 'Update Api Endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/update.status',$current_realm),
'short_description' => 'Update Api Endpoint Status',
'description' => 'Update Api Endpoint Status',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/read.page',$current_realm),
'short_description' => 'Get Api Endpoints By Page',
'description' => 'Get Api Endpoints By Page',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/add.scope',$current_realm),
'short_description' => 'Add required scope to endpoint',
'description' => 'Add required scope to endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-endpoint/remove.scope',$current_realm),
'short_description' => 'Remove required scope to endpoint',
'description' => 'Remove required scope to endpoint',
'api' => $api_endpoint,
'system' => true,
'active' => true,
)
];
foreach($api_scope_payloads as $payload) {
EntityManager::persist(ApiScopeFactory::build($payload));
}
EntityManager::flush();
}
private function seedApiScopeScopes(){
$api_repository = EntityManager::getRepository(Api::class);
$api_scope = $api_repository->findOneBy(['name' => 'api-scope']);
$current_realm = Config::get('app.url');
$api_scope_payloads = [
array(
'name' => sprintf('%s/api-scope/read',$current_realm),
'short_description' => 'Get Api Scope',
'description' => 'Get Api Scope',
'api' => $api_scope,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-scope/delete',$current_realm),
'short_description' => 'Deletes Api Scope',
'description' => 'Deletes Api Scope',
'api' => $api_scope,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-scope/write',$current_realm),
'short_description' => 'Create Api Scope',
'description' => 'Create Api Scope',
'api' => $api_scope,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-scope/update',$current_realm),
'short_description' => 'Update Api Scope',
'description' => 'Update Api Scope',
'api' => $api_scope,
'system' => true,
),
array(
'name' => sprintf('%s/api-scope/update.status',$current_realm),
'short_description' => 'Update Api Scope Status',
'description' => 'Update Api Scope Status',
'api' => $api_scope,
'system' => true,
'active' => true,
),
array(
'name' => sprintf('%s/api-scope/read.page',$current_realm),
'short_description' => 'Get Api Scopes By Page',
'description' => 'Get Api Scopes By Page',
'api' => $api_scope,
'system' => true,
'active' => true,
)
];
foreach($api_scope_payloads as $payload) {
EntityManager::persist(ApiScopeFactory::build($payload));
}
EntityManager::flush();
}
private function seedTestResourceServers(){
$current_realm = Config::get('app.url');
$components = parse_url($current_realm);
$resource_server_payloads = [
array(
'friendly_name' => 'test resource server',
'host' => $components['host'],
'ips' => '127.0.0.1,10.0.0.0,2001:4800:7821:101:be76:4eff:fe06:858b,174.143.201.173',
'active' => true
),
array(
'friendly_name' => 'test resource server 2',
'host' => $components['host'],
'ips' => '10.0.0.0,2001:4800:7821:101:be76:4eff:fe06:858b,174.143.201.173',
'active' => true,
)
];
foreach($resource_server_payloads as $payload) {
EntityManager::persist(ResourceServerFactory::build($payload));
}
EntityManager::flush();
}
private function seedApis(){
$resource_server_repository = EntityManager::getRepository(ResourceServer::class);
$resource_server = $resource_server_repository->findOneBy([
'friendly_name' => 'test resource server'
]);
$api_payloads = [
array(
'name' => 'resource-server',
'active' => true,
'description' => 'Resource Server CRUD operations',
'resource_server' => $resource_server,
'logo' => asset('/assets/img/apis/server.png')
),
array(
'name' => 'api',
'active' => true,
'description' => 'Api CRUD operations',
'resource_server' => $resource_server,
'logo' => asset('/assets/img/apis/server.png')
),
array(
'name' => 'api-endpoint',
'active' => true,
'description' => 'Api Endpoints CRUD operations',
'resource_server' => $resource_server,
'logo' => asset('/assets/img/apis/server.png')
),
array(
'name' => 'api-scope',
'active' => true,
'description' => 'Api Scopes CRUD operations',
'resource_server' => $resource_server,
'logo' => asset('/assets/img/apis/server.png')
),
array(
'name' => 'groups',
'active' => true,
'description' => 'Groups Info API',
'resource_server' => $resource_server,
'logo' => asset('/assets/img/apis/server.png')
),
];
foreach($api_payloads as $payload) {
EntityManager::persist(ApiFactory::build($payload));
}
EntityManager::flush();
}
private function seedTestUsersAndClients(){
$resource_server_repository = EntityManager::getRepository(ResourceServer::class);
$resource_server = $resource_server_repository->findOneBy([
'friendly_name' => 'test resource server'
]);
$resource_server2 = $resource_server_repository->findOneBy([
'friendly_name' => 'test resource server 2'
]);
$user_repository = EntityManager::getRepository(User::class);
$user = $user_repository->findOneBy(['email' => 'sebastian@tipit.net']);
$trusted_site = OpenIdTrustedSiteFactory::build([
'realm' => 'https://www.test.com/',
'policy' => IAuthService::AuthorizationResponse_AllowForever
]);
$user->addTrustedSite($trusted_site);
EntityManager::persist($user);
//EntityManager::flush();
$now = new \DateTime('now', new \DateTimeZone('UTC'));
$client_payloads = [
array(
'app_name' => 'oauth2_test_app',
'app_description' => 'oauth2_test_app',
'app_logo' => null,
'client_id' => '.-_~87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client',
'client_secret' => 'ITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhg',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Web_App,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'https://www.test.com/oauth2,https://op.certification.openid.net:60393/authz_cb',
'id_token_signed_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::HS512,
'id_token_encrypted_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::RSA_OAEP_256,
'id_token_encrypted_response_enc' => JSONWebSignatureAndEncryptionAlgorithms::A256CBC_HS512,
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
),
array
(
'app_name' => 'oauth2_test_app2',
'app_description' => 'oauth2_test_app2',
'app_logo' => null,
'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x2.openstack.client',
'client_secret' => 'ITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhg',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Web_App,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretJwt,
'token_endpoint_auth_signing_alg' => JSONWebSignatureAndEncryptionAlgorithms::HS512,
'subject_type' => IClient::SubjectType_Pairwise,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'https://www.test.com/oauth2',
'id_token_signed_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::HS512,
'id_token_encrypted_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::RSA_OAEP_256,
'id_token_encrypted_response_enc' => JSONWebSignatureAndEncryptionAlgorithms::A256CBC_HS512,
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
),
array(
'app_name' => 'oauth2_test_app3',
'app_description' => 'oauth2_test_app3',
'app_logo' => null,
'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ33.openstack.client',
'client_secret' => 'ITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N7kOtGKhgITc/6Y5N585OtGKhg55',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Web_App,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'https://www.test.com/oauth2',
'id_token_signed_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::HS512,
'userinfo_signed_response_alg' => JSONWebSignatureAndEncryptionAlgorithms::RS512,
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
),
array(
'app_name' => 'oauth2.service',
'app_description' => 'oauth2.service',
'app_logo' => null,
'client_id' => '11z87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client',
'client_secret' => '11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Service,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'https://www.test.com/oauth2',
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
),
array(
'app_name' => 'oauth2_test_app_public',
'app_description' => 'oauth2_test_app_public',
'app_logo' => null,
'client_id' => '1234/Vcvr6fvQbH4HyNgwKlfSyQ3x.openstack.client',
'client_secret' => null,
'application_type' => IClient::ApplicationType_JS_Client,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_PrivateKeyJwt,
'token_endpoint_auth_signing_alg' => JSONWebSignatureAndEncryptionAlgorithms::RS512,
'owner' => $user,
'rotate_refresh_token' => false,
'use_refresh_token' => false,
'redirect_uris' => 'https://www.test.com/oauth2',
),
array(
'app_name' => 'oauth2_test_app_public_pkce',
'app_description' => 'oauth2_test_app_public_pkce',
'app_logo' => null,
'client_id' => '1234/Vcvr6fvQbH4HyNgwKlfSpkce.openstack.client',
'client_secret' => null,
'application_type' => IClient::ApplicationType_JS_Client,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_None,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'https://www.test.com/oauth2',
'pkce_enabled' => true,
),
array(
'app_name' => 'oauth2_native_app',
'app_description' => 'oauth2_native_app',
'app_logo' => null,
'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ3x.android.openstack.client',
'client_secret' => '11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhgfdfdfdf',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Native,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'androipapp://oidc_endpoint_callback',
),
array(
'app_name' => 'oauth2_native_app2',
'app_description' => 'oauth2_native_app2',
'app_logo' => null,
'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ3x.android2.openstack.client',
'client_secret' => '11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhg11c/6Y5N7kOtGKhgfdfdfdf',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Native,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_PrivateKeyJwt,
'token_endpoint_auth_signing_alg' => JSONWebSignatureAndEncryptionAlgorithms::RS512,
'owner' => $user,
'rotate_refresh_token' => true,
'use_refresh_token' => true,
'redirect_uris' => 'androipapp://oidc_endpoint_callback2',
),
array(
'app_name' => 'oauth2_test_app_public_2',
'app_description' => 'oauth2_test_app_public_2',
'app_logo' => null,
'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ2x.openstack.client',
'client_secret' => null,
'client_type' => IClient::ClientType_Public,
'application_type' => IClient::ApplicationType_JS_Client,
'owner' => $user,
'rotate_refresh_token' => false,
'use_refresh_token' => false,
'redirect_uris' => 'https://www.test.com/oauth2'
),
array(
'app_name' => 'resource_server_client',
'app_description' => 'resource_server_client',
'app_logo' => null,
'client_id' => 'resource.server.1.openstack.client',
'client_secret' => '123456789123456789123456789123456789123456789',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Service,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'resource_server' => $resource_server,
'rotate_refresh_token' => false,
'use_refresh_token' => false,
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
),
array(
'app_name' => 'resource_server_client2',
'app_description' => 'resource_server_client2',
'app_logo' => null,
'client_id' => 'resource.server.2.openstack.client',
'client_secret' => '123456789123456789123456789123456789123456789',
'client_type' => IClient::ClientType_Confidential,
'application_type' => IClient::ApplicationType_Service,
'token_endpoint_auth_method' => OAuth2Protocol::TokenEndpoint_AuthMethod_ClientSecretBasic,
'resource_server' => $resource_server2,
'rotate_refresh_token' => false,
'use_refresh_token' => false,
'client_secret_expires_at' => $now->add(new \DateInterval('P6M')),
)
];
foreach ($client_payloads as $payload){
EntityManager::persist(ClientFactory::build($payload));
}
EntityManager::flush();
$client_repository = EntityManager::getRepository(Client::class);
$client_confidential = $client_repository->findOneBy(['app_name' => 'oauth2_test_app']);
$client_confidential2 = $client_repository->findOneBy(['app_name' => 'oauth2_test_app2']);
$client_confidential3 = $client_repository->findOneBy(['app_name' => 'oauth2_test_app3']);
$client_public = $client_repository->findOneBy(['app_name' => 'oauth2_test_app_public']);
$client_public2 = $client_repository->findOneBy(['app_name' => 'oauth2_test_app_public_pkce']);
$client_service = $client_repository->findOneBy(['app_name' => 'oauth2.service']);
$client_native = $client_repository->findOneBy(['app_name' => 'oauth2_native_app']);
$client_native2 = $client_repository->findOneBy(['app_name' => 'oauth2_native_app2']);
//attach all scopes
$scopes_repository = EntityManager::getRepository(ApiScope::class);
$scopes = $scopes_repository->findAll();
foreach($scopes as $scope)
{
$client_confidential->addScope($scope);
$client_confidential2->addScope($scope);
$client_confidential3->addScope($scope);
$client_public->addScope($scope);
$client_public2->addScope($scope);
$client_service->addScope($scope);
$client_native->addScope($scope);
$client_native2->addScope($scope);
}
$now = new \DateTime('now', new DateTimeZone('UTC'));
$to = new \DateTime('now', new DateTimeZone('UTC'));
$to->add(new \DateInterval('P31D'));
$public_key_1 = ClientPublicKey::buildFromPEM(
'public_key_1',
JSONWebKeyTypes::RSA,
JSONWebKeyPublicKeyUseValues::Encryption,
self::$client_public_key_1,