<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Spring-Security on Java &amp; Moi</title><link>https://javaetmoi.com/tags/spring-security/</link><description>Recent content in Spring-Security on Java &amp; Moi</description><generator>Hugo</generator><language>fr</language><lastBuildDate>Sat, 06 Nov 2021 16:53:05 +0000</lastBuildDate><atom:link href="https://javaetmoi.com/tags/spring-security/feed.xml" rel="self" type="application/rss+xml"/><item><title>Configuration Spring Security d’un client de l’API REST Salesforce sécurisée avec OAuth 2.0</title><link>https://javaetmoi.com/2021/11/configuration-spring-security-dun-client-de-lapi-rest-salesforce-securisee-avec-oauth-2-0/</link><pubDate>Sat, 06 Nov 2021 16:53:05 +0000</pubDate><guid isPermaLink="false">https://javaetmoi.com/?p=2138</guid><description>&lt;h2 id="contexte"&gt;Contexte&lt;/h2&gt;
&lt;p&gt;De nos jours, il est courant de devoir &lt;strong&gt;consommer&lt;/strong&gt; une &lt;strong&gt;API REST sécurisée&lt;/strong&gt; à l’aide du standard &lt;strong&gt;OAuth 2.0&lt;/strong&gt; ou de sa surcouche &lt;strong&gt;OpenID Connect&lt;/strong&gt; (OIDC). &lt;br&gt;Schématiquement, le consommateur génère un &lt;strong&gt;jeton (token)&lt;/strong&gt; opaque ou JWT en appelant un serveur d’autorisation (Authorization server) puis, à chaque appel d’API REST, le transmet en tant que bearer via l’ &lt;strong&gt;en-tête HTTP&lt;/strong&gt; &lt;strong&gt;Authorization&lt;/strong&gt;. Ce token a souvent une &lt;strong&gt;durée de vie&lt;/strong&gt; transmise par le serveur d’autorisation via la propriété &lt;strong&gt;expires_in&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;OAuth 2.0 propose quatre cinématiques (flows), la plus commune étant l’Authorization Code Flow. Lorsque l’API REST est appelée depuis une application web, il est courant de voir utiliser le Client Credentials Flow ou le &lt;strong&gt;&lt;a href="https://www.oreilly.com/library/view/getting-started-with/9781449317843/ch04.html"&gt;Resource&lt;/a&gt;&lt;/strong&gt; &lt;strong&gt;&lt;a href="https://www.oreilly.com/library/view/getting-started-with/9781449317843/ch04.html"&gt;Owner Password Credentials Flow&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Récemment, j’ai été amené à &lt;strong&gt;consommer l’API REST du&lt;/strong&gt; &lt;strong&gt;CRM Salesforce&lt;/strong&gt; &lt;strong&gt;depuis une application Spring Boot&lt;/strong&gt;. Cette API était sécurisée avec le Resource Owner password Credentials Flow. Salesforce joue à la fois le rôle de l’Authorization Server et du Resource Owner. Le client (l’application Spring Boot) transmet ses &lt;strong&gt;credentials&lt;/strong&gt; (login et mot de passe) à l’Authorization Server pour obtenir un &lt;strong&gt;Access Token&lt;/strong&gt;. &lt;br&gt;Cet article a pour objectif de vous présenter la &lt;strong&gt;configuration Spring Security&lt;/strong&gt; mise en œuvre pour appeler cette API. Les extraits de code proviennent du repository GitHub &lt;a href="https://github.com/arey/spring-security-oauth2-salesforce-sample"&gt;&lt;strong&gt;arey/spring-security-oauth2-salesforce-sample&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Spring Core 4.2 Certification Mock Exam</title><link>https://javaetmoi.com/2016/01/spring-core-4-2-certification-mock-exam/</link><pubDate>Mon, 18 Jan 2016 07:05:32 +0000</pubDate><guid isPermaLink="false">http://javaetmoi.com/?p=1508</guid><description>&lt;p&gt;&lt;figure&gt;
&lt;picture&gt;
&lt;img
loading="lazy"
decoding="async"
alt="spring-pro-cert"
class="image_figure image_internal image_unprocessed"
src="https://javaetmoi.com/wp-content/uploads/2016/01/spring-pro-cert.jpg"
/&gt;
&lt;/picture&gt;
&lt;/figure&gt;
Four years ago, I’ve published a first &lt;a href="http://javaetmoi.com/2012/02/core-spring-3-0-certification-mock-exam/"&gt;mock exam for the Spring Core 3.0 Certification&lt;/a&gt;. Encouraged by Michael and Alan, I’ve updated this &lt;strong&gt;free&lt;/strong&gt; &lt;strong&gt;mock exam&lt;/strong&gt; for the &lt;a href="http://pivotal.io/academy#certification"&gt;Spring Professional certification based on the Spring Core 4.2 course&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;According to the &lt;a href="wp-content/uploads/2016/01/Core-Spring-4.2-Certification-Study-Guide.pdf"&gt;Core Spring 4.2 Certification Study Guide&lt;/a&gt;, 3 new topics have been added to the &lt;strong&gt;Spring Core 4.2 mock exam&lt;/strong&gt;: &lt;strong&gt;REST&lt;/strong&gt;, &lt;strong&gt;Microservices&lt;/strong&gt; and &lt;strong&gt;Spring Cloud&lt;/strong&gt;. They replace older topics: JMX, JMS and Remoting.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;picture&gt;
&lt;img
loading="lazy"
decoding="async"
alt="spring-pro-cert"
class="image_figure image_internal image_unprocessed"
src="https://javaetmoi.com/wp-content/uploads/2016/01/spring-pro-cert.jpg"
/&gt;
&lt;/picture&gt;
&lt;/figure&gt;
&lt;/p&gt;</description></item><item><title>Configurez Spring en Java</title><link>https://javaetmoi.com/2014/06/spring-framework-java-configuration/</link><pubDate>Mon, 16 Jun 2014 05:07:42 +0000</pubDate><guid isPermaLink="false">http://javaetmoi.com/?p=1122</guid><description>Dans ce billet, nous verrons comment &lt;strong&gt;configurer en Java&lt;/strong&gt; le &lt;strong&gt;contexte Spring&lt;/strong&gt; d’une application basée sur &lt;strong&gt;Spring MVC&lt;/strong&gt;, &lt;strong&gt;Spring Security&lt;/strong&gt;, &lt;strong&gt;Spring Data JPA&lt;/strong&gt; et &lt;strong&gt;Hibernate&lt;/strong&gt;, et cela sans utiliser la moindre ligne de XML.&lt;br&gt;Personnellement, je n’ai rien contre la &lt;strong&gt;syntaxe XML&lt;/strong&gt; à laquelle j’étais habitué. D’autant la &lt;strong&gt;verbosité&lt;/strong&gt; de la configuration avait considérablement diminué grâce à l’introduction des &lt;strong&gt;namespaces XML&lt;/strong&gt; et des &lt;strong&gt;annotations&lt;/strong&gt;. Avant d’utiliser la syntaxe Java sur une application d’entreprise, j’étais même sceptique quant aux gains qu’elle pouvait apporter. Aujourd’hui, je comprends mieux son intérêt et pourquoi les projets du portfolio Spring tels &lt;a href="http://spring.io/blog/2014/04/30/spring-integration-4-0-released"&gt;Spring Integration 4.0&lt;/a&gt;, &lt;a href="#ZgotmplZ"&gt;Spring Web Service 2.2&lt;/a&gt; ou bien &lt;a href="http://spring.io/blog/2013/07/03/spring-security-java-config-preview-web-security"&gt;Spring Security 3.2&lt;/a&gt; proposent dans leur dernière version un niveau de configuration Java iso-fonctionnel avec leur équivalent XML. Sans compter que le support de la configuration Java leur ouvre la porte d’une intégration plus poussée à &lt;a href="http://projects.spring.io/spring-boot/"&gt;&lt;strong&gt;Spring Boot&lt;/strong&gt;&lt;/a&gt;, le nouveau fer de lance de Pivotal.&lt;br&gt;</description></item></channel></rss>