From 5444c74a441576b2019014923316a95762bd5b8f Mon Sep 17 00:00:00 2001 From: Conrado Costa Date: Sun, 26 May 2024 19:13:01 -0400 Subject: [PATCH] add basic example --- README.md | 4 ++++ examples/basic/.gitattributes | 2 ++ examples/basic/.gitignore | 3 +++ examples/basic/addons | 1 + examples/basic/icon.svg | 1 + examples/basic/icon.svg.import | 37 +++++++++++++++++++++++++++++++++ examples/basic/login_screen.gd | 13 ++++++++++++ examples/basic/project.godot | 31 +++++++++++++++++++++++++++ examples/basic/signin_page.tscn | 22 ++++++++++++++++++++ 9 files changed, 114 insertions(+) create mode 100644 README.md create mode 100644 examples/basic/.gitattributes create mode 100644 examples/basic/.gitignore create mode 120000 examples/basic/addons create mode 100644 examples/basic/icon.svg create mode 100644 examples/basic/icon.svg.import create mode 100644 examples/basic/login_screen.gd create mode 100644 examples/basic/project.godot create mode 100644 examples/basic/signin_page.tscn diff --git a/README.md b/README.md new file mode 100644 index 0000000..c60331f --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# godot_keycloak +## TODO +- [ ] create client / server example +- [ ] add other OAuth providers diff --git a/examples/basic/.gitattributes b/examples/basic/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/examples/basic/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/examples/basic/.gitignore b/examples/basic/.gitignore new file mode 100644 index 0000000..78df558 --- /dev/null +++ b/examples/basic/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +**/.DS_Store \ No newline at end of file diff --git a/examples/basic/addons b/examples/basic/addons new file mode 120000 index 0000000..e652105 --- /dev/null +++ b/examples/basic/addons @@ -0,0 +1 @@ +../../addons \ No newline at end of file diff --git a/examples/basic/icon.svg b/examples/basic/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/examples/basic/icon.svg @@ -0,0 +1 @@ + diff --git a/examples/basic/icon.svg.import b/examples/basic/icon.svg.import new file mode 100644 index 0000000..1864cda --- /dev/null +++ b/examples/basic/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c3jx5ltudkvvm" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/examples/basic/login_screen.gd b/examples/basic/login_screen.gd new file mode 100644 index 0000000..dec45b4 --- /dev/null +++ b/examples/basic/login_screen.gd @@ -0,0 +1,13 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + var container = get_child(0) + var vbox = Keycloak.basic.generate_basic_form() + vbox.add_child(Keycloak.google.generate_google_btn()) + container.add_child(vbox) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass diff --git a/examples/basic/project.godot b/examples/basic/project.godot new file mode 100644 index 0000000..1445263 --- /dev/null +++ b/examples/basic/project.godot @@ -0,0 +1,31 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Basic Keycloak Example" +config/features=PackedStringArray("4.2", "Forward Plus") +config/icon="res://icon.svg" + +[autoload] + +Keycloak="*res://addons/keycloak/src/auth.gd" + +[editor_plugins] + +enabled=PackedStringArray("res://addons/jwt/plugin.cfg", "res://addons/keycloak/plugin.cfg") + +[keycloak] + +realm_id="my_keycloak_realm" +client_id="game_client_id" +client_secret="super_secret" +server_addr="127.0.0.1" +server_port=8080 diff --git a/examples/basic/signin_page.tscn b/examples/basic/signin_page.tscn new file mode 100644 index 0000000..668211d --- /dev/null +++ b/examples/basic/signin_page.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=3 uid="uid://df22wowcpshwq"] + +[ext_resource type="Script" path="res://login_screen.gd" id="1_oulpi"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_oulpi") + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2