From 7ff3b424774de545ff903bb0f9e340e38be32c2e Mon Sep 17 00:00:00 2001 From: fvergaracl Date: Thu, 20 Jun 2024 12:11:02 +0200 Subject: [PATCH] flutter example added --- .../keycloak/examples/flutter/.gitignore | 1 - .../tools/keycloak/examples/flutter/README.md | 2 +- .../examples/flutter/android/app/build.gradle | 18 +-- .../android/app/src/main/AndroidManifest.xml | 58 +++++---- .../example/keycloak_example/MainActivity.kt | 12 -- .../com/example/keycloaklogin/MainActivity.kt | 5 + .../ios/Runner.xcodeproj/project.pbxproj | 12 +- .../examples/flutter/ios/Runner/Info.plist | 103 +++++++-------- .../examples/flutter/lib/login_page.dart | 117 +++++++++++++++++- .../examples/flutter/linux/CMakeLists.txt | 4 +- .../examples/flutter/linux/my_application.cc | 4 +- .../macos/Runner.xcodeproj/project.pbxproj | 18 +-- .../xcshareddata/xcschemes/Runner.xcscheme | 8 +- .../macos/Runner/Configs/AppInfo.xcconfig | 4 +- .../keycloak/examples/flutter/pubspec.yaml | 40 +++++- .../examples/flutter/test/widget_test.dart | 2 +- .../keycloak/examples/flutter/web/index.html | 4 +- .../examples/flutter/web/manifest.json | 4 +- .../examples/flutter/windows/CMakeLists.txt | 4 +- .../examples/flutter/windows/runner/Runner.rc | 8 +- .../examples/flutter/windows/runner/main.cpp | 2 +- 21 files changed, 280 insertions(+), 150 deletions(-) delete mode 100644 docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloak_example/MainActivity.kt create mode 100644 docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloaklogin/MainActivity.kt diff --git a/docs/tools/keycloak/examples/flutter/.gitignore b/docs/tools/keycloak/examples/flutter/.gitignore index fc62e0a..29a3a50 100644 --- a/docs/tools/keycloak/examples/flutter/.gitignore +++ b/docs/tools/keycloak/examples/flutter/.gitignore @@ -41,4 +41,3 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release -assets/.env \ No newline at end of file diff --git a/docs/tools/keycloak/examples/flutter/README.md b/docs/tools/keycloak/examples/flutter/README.md index d12bca5..ba2d7d2 100644 --- a/docs/tools/keycloak/examples/flutter/README.md +++ b/docs/tools/keycloak/examples/flutter/README.md @@ -1,4 +1,4 @@ -# keycloak_example +# keycloaklogin A new Flutter project. diff --git a/docs/tools/keycloak/examples/flutter/android/app/build.gradle b/docs/tools/keycloak/examples/flutter/android/app/build.gradle index 98aea43..44a1938 100644 --- a/docs/tools/keycloak/examples/flutter/android/app/build.gradle +++ b/docs/tools/keycloak/examples/flutter/android/app/build.gradle @@ -24,7 +24,7 @@ if (flutterVersionName == null) { } android { - namespace = "com.example.keycloak_example" + namespace = "com.example.keycloaklogin" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion @@ -34,20 +34,19 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.example.keycloak_example" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + applicationId = "com.example.keycloaklogin" minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutterVersionCode.toInteger() versionName = flutterVersionName + manifestPlaceholders = [ + appAuthRedirectScheme: "com.example.keycloaklogin", + applicationName: "io.flutter.app.FlutterApplication" // Add this line + ] } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.debug } } @@ -57,8 +56,3 @@ flutter { source = "../.." } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.google.android.gms:play-services-auth:19.0.0' - implementation 'aqndroidx.browser:browser:1.3.0' -} diff --git a/docs/tools/keycloak/examples/flutter/android/app/src/main/AndroidManifest.xml b/docs/tools/keycloak/examples/flutter/android/app/src/main/AndroidManifest.xml index f0d617b..8605f92 100644 --- a/docs/tools/keycloak/examples/flutter/android/app/src/main/AndroidManifest.xml +++ b/docs/tools/keycloak/examples/flutter/android/app/src/main/AndroidManifest.xml @@ -1,21 +1,37 @@ - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloak_example/MainActivity.kt b/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloak_example/MainActivity.kt deleted file mode 100644 index 0b6e006..0000000 --- a/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloak_example/MainActivity.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.example.keycloak_example; - -import io.flutter.embedding.android.FlutterFragmentActivity; -import io.flutter.embedding.engine.FlutterEngine; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterFragmentActivity { - @Override - public void configureFlutterEngine(FlutterEngine flutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } -} diff --git a/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloaklogin/MainActivity.kt b/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloaklogin/MainActivity.kt new file mode 100644 index 0000000..521c413 --- /dev/null +++ b/docs/tools/keycloak/examples/flutter/android/app/src/main/kotlin/com/example/keycloaklogin/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.keycloaklogin + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/docs/tools/keycloak/examples/flutter/ios/Runner.xcodeproj/project.pbxproj b/docs/tools/keycloak/examples/flutter/ios/Runner.xcodeproj/project.pbxproj index f5738b4..4f83776 100644 --- a/docs/tools/keycloak/examples/flutter/ios/Runner.xcodeproj/project.pbxproj +++ b/docs/tools/keycloak/examples/flutter/ios/Runner.xcodeproj/project.pbxproj @@ -368,7 +368,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -384,7 +384,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -401,7 +401,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -416,7 +416,7 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -547,7 +547,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -569,7 +569,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/docs/tools/keycloak/examples/flutter/ios/Runner/Info.plist b/docs/tools/keycloak/examples/flutter/ios/Runner/Info.plist index f482190..27c87f5 100644 --- a/docs/tools/keycloak/examples/flutter/ios/Runner/Info.plist +++ b/docs/tools/keycloak/examples/flutter/ios/Runner/Info.plist @@ -1,60 +1,49 @@ - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Keycloak Example - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - keycloak_example - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - - CFBundleURLTypes - - - CFBundleTypeRole - Editor - CFBundleURLSchemes - - com.example.keycloak_example - - - - - \ No newline at end of file + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Keycloaklogin + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + keycloaklogin + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/docs/tools/keycloak/examples/flutter/lib/login_page.dart b/docs/tools/keycloak/examples/flutter/lib/login_page.dart index 12995a8..b819efc 100644 --- a/docs/tools/keycloak/examples/flutter/lib/login_page.dart +++ b/docs/tools/keycloak/examples/flutter/lib/login_page.dart @@ -13,6 +13,8 @@ class _LoginPageState extends State { final FlutterAppAuth _appAuth = FlutterAppAuth(); String? _accessToken; String? _idToken; + String? _refreshToken; + Map? _profile; Future _login() async { // PRINT ENVIRONMENT CONFIG @@ -36,7 +38,12 @@ class _LoginPageState extends State { setState(() { _accessToken = result.accessToken; _idToken = result.idToken; + _refreshToken = result.refreshToken; + _profile = _decodeJWT(_idToken!); }); + if (result.idToken != null) { + print('Profile: $_profile'); + } } } catch (e) { print('Error during login: $e'); @@ -56,7 +63,8 @@ class _LoginPageState extends State { final userInfo = json.decode(response.body); print('User info: $userInfo'); } else { - print('Failed to fetch user info'); + print( + 'Failed to fetch user info: ${response.statusCode} ${response.body}'); } } catch (e) { print('Error fetching user info: $e'); @@ -64,6 +72,78 @@ class _LoginPageState extends State { } } + Future _logout() async { + print('Logging out...'); + print(_refreshToken); + if (_refreshToken != null) { + try { + final response = await http.post( + Uri.parse( + 'https://auth1.demo.greengage-project.eu/auth/realms/greengage/protocol/openid-connect/logout'), + headers: {'Content-Type': 'application/x-www-form-urlencoded'}, + body: + 'client_id=${Uri.encodeQueryComponent(EnvironmentConfig.clientId)}&refresh_token=${Uri.encodeQueryComponent(_refreshToken!)}', + ); + + print(' '); + print(' '); + print(' '); + print(_profile); + print(' '); + print(' '); + print(' '); + + if (response.statusCode == 204) { + setState(() { + _accessToken = null; + _idToken = null; + _refreshToken = null; + _profile = null; + }); + print('Logged out successfully'); + } else { + print('Failed to logout: ${response.statusCode} ${response.body}'); + } + } catch (e) { + print('Error during logout: $e'); + } + } + } + + Map _decodeJWT(String token) { + final parts = token.split('.'); + if (parts.length != 3) { + throw Exception('Invalid token'); + } + + final payload = _decodeBase64(parts[1]); + final payloadMap = json.decode(payload); + if (payloadMap is! Map) { + throw Exception('Invalid payload'); + } + + return payloadMap; + } + + String _decodeBase64(String str) { + String output = str.replaceAll('-', '+').replaceAll('_', '/'); + + switch (output.length % 4) { + case 0: + break; + case 2: + output += '=='; + break; + case 3: + output += '='; + break; + default: + throw Exception('Illegal base64url string'); + } + + return utf8.decode(base64Url.decode(output)); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -73,10 +153,33 @@ class _LoginPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ if (_accessToken != null) - Text('Access Token: $_accessToken', + ElevatedButton( + onPressed: _logout, + child: Text('Logout'), + ), + if (_profile != null) ...[ + Text('Name: ${_profile!['name']}', + style: TextStyle(fontSize: 16)), + Text('Preferred Username: ${_profile!['preferred_username']}', + style: TextStyle(fontSize: 16)), + Text('Locale: ${_profile!['locale']}', style: TextStyle(fontSize: 16)), - if (_idToken != null) - Text('ID Token: $_idToken', style: TextStyle(fontSize: 16)), + if (_profile!['picture'] != null) + Image.network(_profile!['picture']), + Container( + margin: EdgeInsets.only(bottom: 16), + child: Text('Id: ${_profile!['sid']}', + style: TextStyle( + fontSize: 16, + color: Colors.red, + fontWeight: FontWeight.bold, + )), + ), + ], + Text('Access Token: $_accessToken', style: TextStyle(fontSize: 16)), + if (_accessToken != null) + if (_idToken != null) + Text('ID Token: $_idToken', style: TextStyle(fontSize: 16)), SizedBox(height: 20), ElevatedButton( onPressed: _login, @@ -93,3 +196,9 @@ class _LoginPageState extends State { ); } } + +void main() { + runApp(MaterialApp( + home: LoginPage(), + )); +} diff --git a/docs/tools/keycloak/examples/flutter/linux/CMakeLists.txt b/docs/tools/keycloak/examples/flutter/linux/CMakeLists.txt index ed44dc2..4e74b55 100644 --- a/docs/tools/keycloak/examples/flutter/linux/CMakeLists.txt +++ b/docs/tools/keycloak/examples/flutter/linux/CMakeLists.txt @@ -4,10 +4,10 @@ project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "keycloak_example") +set(BINARY_NAME "keycloaklogin") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.example.keycloak_example") +set(APPLICATION_ID "com.example.keycloaklogin") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/docs/tools/keycloak/examples/flutter/linux/my_application.cc b/docs/tools/keycloak/examples/flutter/linux/my_application.cc index fc3e638..f35bfaa 100644 --- a/docs/tools/keycloak/examples/flutter/linux/my_application.cc +++ b/docs/tools/keycloak/examples/flutter/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "keycloak_example"); + gtk_header_bar_set_title(header_bar, "keycloaklogin"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "keycloak_example"); + gtk_window_set_title(window, "keycloaklogin"); } gtk_window_set_default_size(window, 1280, 720); diff --git a/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/project.pbxproj b/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/project.pbxproj index c9ff997..4ccf987 100644 --- a/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/project.pbxproj +++ b/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/project.pbxproj @@ -64,7 +64,7 @@ 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* keycloak_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "keycloak_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* keycloaklogin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "keycloaklogin.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -131,7 +131,7 @@ 33CC10EE2044A3C60003C045 /* Products */ = { isa = PBXGroup; children = ( - 33CC10ED2044A3C60003C045 /* keycloak_example.app */, + 33CC10ED2044A3C60003C045 /* keycloaklogin.app */, 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, ); name = Products; @@ -217,7 +217,7 @@ ); name = Runner; productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* keycloak_example.app */; + productReference = 33CC10ED2044A3C60003C045 /* keycloaklogin.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -385,10 +385,10 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloak_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloak_example"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloaklogin.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloaklogin"; }; name = Debug; }; @@ -399,10 +399,10 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloak_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloak_example"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloaklogin.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloaklogin"; }; name = Release; }; @@ -413,10 +413,10 @@ CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloak_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloak_example"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/keycloaklogin.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/keycloaklogin"; }; name = Profile; }; diff --git a/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d3ba770..6219dba 100644 --- a/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/docs/tools/keycloak/examples/flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -15,7 +15,7 @@ @@ -31,7 +31,7 @@ @@ -65,7 +65,7 @@ @@ -82,7 +82,7 @@ diff --git a/docs/tools/keycloak/examples/flutter/macos/Runner/Configs/AppInfo.xcconfig b/docs/tools/keycloak/examples/flutter/macos/Runner/Configs/AppInfo.xcconfig index 0dd35d3..2bf1eb5 100644 --- a/docs/tools/keycloak/examples/flutter/macos/Runner/Configs/AppInfo.xcconfig +++ b/docs/tools/keycloak/examples/flutter/macos/Runner/Configs/AppInfo.xcconfig @@ -5,10 +5,10 @@ // 'flutter create' template. // The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = keycloak_example +PRODUCT_NAME = keycloaklogin // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloakExample +PRODUCT_BUNDLE_IDENTIFIER = com.example.keycloaklogin // The copyright displayed in application information PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/docs/tools/keycloak/examples/flutter/pubspec.yaml b/docs/tools/keycloak/examples/flutter/pubspec.yaml index 5afdc62..edb6b46 100644 --- a/docs/tools/keycloak/examples/flutter/pubspec.yaml +++ b/docs/tools/keycloak/examples/flutter/pubspec.yaml @@ -1,4 +1,4 @@ -name: keycloak_example +name: keycloaklogin description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. @@ -36,9 +36,6 @@ dependencies: universal_io: ^2.2.2 openid_client: ^0.4.8 universal_html: ^2.2.4 - - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 dev_dependencies: @@ -57,7 +54,40 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. uses-material-design: true - assets: - assets/.env + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/docs/tools/keycloak/examples/flutter/test/widget_test.dart b/docs/tools/keycloak/examples/flutter/test/widget_test.dart index 28d2ce4..5abbd3d 100644 --- a/docs/tools/keycloak/examples/flutter/test/widget_test.dart +++ b/docs/tools/keycloak/examples/flutter/test/widget_test.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:keycloak_example/main.dart'; +import 'package:keycloaklogin/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { diff --git a/docs/tools/keycloak/examples/flutter/web/index.html b/docs/tools/keycloak/examples/flutter/web/index.html index 1c6de8e..592977d 100644 --- a/docs/tools/keycloak/examples/flutter/web/index.html +++ b/docs/tools/keycloak/examples/flutter/web/index.html @@ -23,13 +23,13 @@ - + - keycloak_example + keycloaklogin diff --git a/docs/tools/keycloak/examples/flutter/web/manifest.json b/docs/tools/keycloak/examples/flutter/web/manifest.json index c45cb78..daefcf7 100644 --- a/docs/tools/keycloak/examples/flutter/web/manifest.json +++ b/docs/tools/keycloak/examples/flutter/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "keycloak_example", - "short_name": "keycloak_example", + "name": "keycloaklogin", + "short_name": "keycloaklogin", "start_url": ".", "display": "standalone", "background_color": "#0175C2", diff --git a/docs/tools/keycloak/examples/flutter/windows/CMakeLists.txt b/docs/tools/keycloak/examples/flutter/windows/CMakeLists.txt index 0c78d82..421eb92 100644 --- a/docs/tools/keycloak/examples/flutter/windows/CMakeLists.txt +++ b/docs/tools/keycloak/examples/flutter/windows/CMakeLists.txt @@ -1,10 +1,10 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(keycloak_example LANGUAGES CXX) +project(keycloaklogin LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "keycloak_example") +set(BINARY_NAME "keycloaklogin") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/docs/tools/keycloak/examples/flutter/windows/runner/Runner.rc b/docs/tools/keycloak/examples/flutter/windows/runner/Runner.rc index fc9924e..21f125f 100644 --- a/docs/tools/keycloak/examples/flutter/windows/runner/Runner.rc +++ b/docs/tools/keycloak/examples/flutter/windows/runner/Runner.rc @@ -90,12 +90,12 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "keycloak_example" "\0" + VALUE "FileDescription", "keycloaklogin" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "keycloak_example" "\0" + VALUE "InternalName", "keycloaklogin" "\0" VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "keycloak_example.exe" "\0" - VALUE "ProductName", "keycloak_example" "\0" + VALUE "OriginalFilename", "keycloaklogin.exe" "\0" + VALUE "ProductName", "keycloaklogin" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/docs/tools/keycloak/examples/flutter/windows/runner/main.cpp b/docs/tools/keycloak/examples/flutter/windows/runner/main.cpp index 10769f3..6c14677 100644 --- a/docs/tools/keycloak/examples/flutter/windows/runner/main.cpp +++ b/docs/tools/keycloak/examples/flutter/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"keycloak_example", origin, size)) { + if (!window.Create(L"keycloaklogin", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true);