Skip to content

Commit 8d5b173

Browse files
committed
Reduce size of openid.dart - extract scopesSupported.
1 parent 5d81ffd commit 8d5b173

File tree

2 files changed

+74
-45
lines changed

2 files changed

+74
-45
lines changed

lib/src/openid/src/openid.dart

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import 'package:pointycastle/digests/sha256.dart';
3939
import 'http_util.dart' as http;
4040
import 'model.dart';
4141
import 'openid_exception.dart';
42+
import 'scopes.dart';
4243

4344
export 'model.dart';
4445
export 'http_util.dart' show HttpRequestException;
@@ -89,51 +90,7 @@ class Issuer {
8990
'userinfo_endpoint': 'https://graph.facebook.com/v2.8/879023912133394',
9091
'response_types_supported': ['token', 'code', 'code token'],
9192
'token_endpoint_auth_methods_supported': ['client_secret_post'],
92-
'scopes_supported': [
93-
'public_profile',
94-
'user_friends',
95-
'email',
96-
'user_about_me',
97-
'user_actions.books',
98-
'user_actions.fitness',
99-
'user_actions.music',
100-
'user_actions.news',
101-
'user_actions.video',
102-
'user_birthday',
103-
'user_education_history',
104-
'user_events',
105-
'user_games_activity',
106-
'user_hometown',
107-
'user_likes',
108-
'user_location',
109-
'user_managed_groups',
110-
'user_photos',
111-
'user_posts',
112-
'user_relationships',
113-
'user_relationship_details',
114-
'user_religion_politics',
115-
'user_tagged_places',
116-
'user_videos',
117-
'user_website',
118-
'user_work_history',
119-
'read_custom_friendlists',
120-
'read_insights',
121-
'read_audience_network_insights',
122-
'read_page_mailboxes',
123-
'manage_pages',
124-
'publish_pages',
125-
'publish_actions',
126-
'rsvp_event',
127-
'pages_show_list',
128-
'pages_manage_cta',
129-
'pages_manage_instant_articles',
130-
'ads_read',
131-
'ads_management',
132-
'business_management',
133-
'pages_messaging',
134-
'pages_messaging_subscriptions',
135-
'pages_messaging_phone_number',
136-
],
93+
'scopes_supported': supportedScopes,
13794
}),
13895
),
13996
google: null,

lib/src/openid/src/scopes.dart

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright (c) 2017, Rik Bellens.
2+
// All rights reserved.
3+
4+
// Redistribution and use in source and binary forms, with or without
5+
// modification, are permitted provided that the following conditions are met:
6+
// * Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// * Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
// * Neither the name of the <organization> nor the
12+
// names of its contributors may be used to endorse or promote products
13+
// derived from this software without specific prior written permission.
14+
15+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19+
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
26+
// ignore_for_file: depend_on_referenced_packages
27+
28+
const supportedScopes = [
29+
'public_profile',
30+
'user_friends',
31+
'email',
32+
'user_about_me',
33+
'user_actions.books',
34+
'user_actions.fitness',
35+
'user_actions.music',
36+
'user_actions.news',
37+
'user_actions.video',
38+
'user_birthday',
39+
'user_education_history',
40+
'user_events',
41+
'user_games_activity',
42+
'user_hometown',
43+
'user_likes',
44+
'user_location',
45+
'user_managed_groups',
46+
'user_photos',
47+
'user_posts',
48+
'user_relationships',
49+
'user_relationship_details',
50+
'user_religion_politics',
51+
'user_tagged_places',
52+
'user_videos',
53+
'user_website',
54+
'user_work_history',
55+
'read_custom_friendlists',
56+
'read_insights',
57+
'read_audience_network_insights',
58+
'read_page_mailboxes',
59+
'manage_pages',
60+
'publish_pages',
61+
'publish_actions',
62+
'rsvp_event',
63+
'pages_show_list',
64+
'pages_manage_cta',
65+
'pages_manage_instant_articles',
66+
'ads_read',
67+
'ads_management',
68+
'business_management',
69+
'pages_messaging',
70+
'pages_messaging_subscriptions',
71+
'pages_messaging_phone_number',
72+
];

0 commit comments

Comments
 (0)