<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Security &#8211; The Eternal Path</title>
	<atom:link href="https://arasan.de/tag/security/feed/" rel="self" type="application/rss+xml" />
	<link>https://arasan.de</link>
	<description>Arasan.de</description>
	<lastBuildDate>Tue, 06 Dec 2022 13:37:24 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://arasan.de/wp-content/uploads/2024/10/triquetra-512x512-1.png</url>
	<title>Security &#8211; The Eternal Path</title>
	<link>https://arasan.de</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Symfony TodoApp &#8211; Login + Registrierung hinzufügen</title>
		<link>https://arasan.de/symfony-todoapp-login-registrierung-hinzufuegen/</link>
		
		<dc:creator><![CDATA[«Æ»]]></dc:creator>
		<pubDate>Fri, 16 Sep 2022 15:25:25 +0000</pubDate>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[SymfonyTodoApp]]></category>
		<category><![CDATA[User]]></category>
		<guid isPermaLink="false">https://arasan.de/?p=651</guid>

					<description><![CDATA[Wir möchten das Erstellen, Bearbeiten und Löschen von TodoItems nur erlauben, wenn ein User Rechte dafür hat.Symfony bietet dafür eine Security Komponente, die das Registrieren und den Login von Usern vereinfacht und den Zugriff auf bestimmte Routen einschränken kann. Wir erstellen eine User Entity und Repository: Wir erstellen eine neue Migration-Datei, damit die Tabelle User&#8230;]]></description>
										<content:encoded><![CDATA[<ol style="margin: 20px"><li><a href="https://arasan.de/symfony-todoapp-projekt-mit-git-github-erstellen/">Symfony TodoApp &#8211; Projekt mit Git + Github erstellen</a></li><li><a href="https://arasan.de/symfony-todoapp-todoscontroller-erstellen/">Symfony TodoApp &#8211; TodosController erstellen</a></li><li><a href="https://arasan.de/symfony-todoapp-twig-template-anpassen/">Symfony TodoApp &#8211; Twig Template anpassen</a></li><li><a href="https://arasan.de/symfony-todo-app-bootstrap-styles-hinzufuegen/">Symfony Todo App &#8211; Bootstrap Styles hinzufügen</a></li><li><a href="https://arasan.de/symfony-todo-app-todoscontroller-create-route-hinzufuegen/">Symfony Todo App &#8211; TodosController: Create Route hinzufügen</a></li><li><a href="https://arasan.de/symfony-todo-app-datenbankverbindung-erstellen/">Symfony Todo App &#8211; Datenbankverbindung erstellen</a></li><li><a href="https://arasan.de/symfony-todo-app-entity-repository-erstellen/">Symfony Todo App &#8211; Entity + Repository erstellen</a></li><li><a href="https://arasan.de/symfony-todo-app-todoitems-aus-tableplus-tabelle-anzeigen/">Symfony Todo App – TodoItems aus TablePlus Tabelle anzeigen</a></li><li><a href="https://arasan.de/symfony-todo-app-formular-fuer-erstellen-von-todoitems-erzeugen/">Symfony todo App &#8211; Formular für Erstellen von TodoItems erzeugen</a></li><li><a href="https://arasan.de/symfony-todo-app-formular-fuer-bearbeiten-von-todoitems-erzeugen/">Symfony Todo App &#8211; Formular für Bearbeiten von TodoItems erzeugen</a></li><li><a href="https://arasan.de/symfony-todoapp-loeschen-funktion-fuer-todoitems-erzeugen/">Symfony TodoApp &#8211; Löschen-Funktion für TodoItems erzeugen</a></li><li>Symfony TodoApp &#8211; Login + Registrierung hinzufügen</li></ol>



<p class="wp-block-paragraph">Wir möchten das Erstellen, Bearbeiten und Löschen von TodoItems nur erlauben, wenn ein User Rechte dafür hat.<br>Symfony bietet dafür eine Security Komponente, die das Registrieren und den Login von Usern vereinfacht und den Zugriff auf bestimmte Routen einschränken kann.</p>



<pre class="wp-block-code"><code>composer require security</code></pre>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1816" height="794" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-composer-require-security.png" alt="" class="wp-image-654"/></figure>



<p class="wp-block-paragraph">Wir erstellen eine User Entity und Repository:</p>



<pre class="wp-block-code"><code>php bin/console make:user User</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="1822" height="1068" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-php-bin-console-make-user-user.png" alt="" class="wp-image-655"/></figure>



<p class="wp-block-paragraph">Wir erstellen eine neue Migration-Datei, damit die Tabelle User in der Datenbank erstellt werden kann.</p>



<pre class="wp-block-code"><code>php bin/console make:migration</code></pre>



<figure class="wp-block-image size-full"><img decoding="async" width="1820" height="496" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-php-bin-console-make-migration.png" alt="" class="wp-image-656"/></figure>



<p class="wp-block-paragraph">Jetzt aktualisieren wir unsere Datenbank mit der User-Tabelle mit:</p>



<pre class="wp-block-code"><code>php bin/console doctrine:migrations:migrate</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1832" height="448" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-php-bin-console-doctrine-migrations-migrate-user.png" alt="" class="wp-image-661"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1950" height="940" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-user-table-tableplus.png" alt="" class="wp-image-662"/></figure>



<p class="wp-block-paragraph">Jetzt können wir die Registrierungsform zum Registrieren von Usern erstellen:</p>



<pre class="wp-block-code"><code>php bin/console make:registration-form</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1826" height="1834" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-php-bin-console-make-registration-form.png" alt="" class="wp-image-664"/></figure>



<p class="wp-block-paragraph">Anschließend registrieren wir einen User über das neue Registrierungs-Formular:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-register-user-form-browser.png" alt="" class="wp-image-666" width="516" height="479"/></figure>



<p class="wp-block-paragraph">Der neue User ist in der Tabelle User in TablePlus sichtbar:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1912" height="976" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-new-registered-user-inuser-table-tableplus.png" alt="" class="wp-image-667"/></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1816" height="1162" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-php-bin-console-make-auth.png" alt="" class="wp-image-669"/></figure>



<p class="wp-block-paragraph">Das Formular zum Einloggen sieht wie folgt aus:</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-login-form-browser.png" alt="" class="wp-image-671" width="553" height="512"/></figure>



<p class="wp-block-paragraph">Nach erfolgreichem Login leiten wir zu der Route mit dem Namen &#8222;app_todos.index&#8220; weiter.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2884" height="1846" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-login-form-authenticator-redirect-after-login.png" alt="" class="wp-image-672"/></figure>



<p class="wp-block-paragraph">In der &#8222;security.yaml&#8220; Konfigurationsdatei im config-Verzeichnis können wir neben der Weiterleitung beim Logout auch den Zugriff auf Routen für bestimmte User-Rollen beschränken (unter dem Eintrag &#8222;access_control&#8220;).</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2890" height="1844" src="https://arasan.de/wp-content/uploads/2022/09/symfony-symfapp-logout-redirect-config-security-yaml-vscode.png" alt="" class="wp-image-670"/></figure>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
