<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dilek Karadaş Mataracı on Medium]]></title>
        <description><![CDATA[Stories by Dilek Karadaş Mataracı on Medium]]></description>
        <link>https://medium.com/@dilekkaradas?source=rss-6b70d968d4dd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y_EZvAi1nPmLtXJZVvledw.jpeg</url>
            <title>Stories by Dilek Karadaş Mataracı on Medium</title>
            <link>https://medium.com/@dilekkaradas?source=rss-6b70d968d4dd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 19:04:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dilekkaradas/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Redis as a Distributed Cache in Spring Boot Applications]]></title>
            <link>https://medium.com/@dilekkaradas/using-redis-as-a-distributed-cache-in-spring-boot-applications-3b11962190e3?source=rss-6b70d968d4dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b11962190e3</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[distributed-caching]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Dilek Karadaş Mataracı]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 06:43:21 GMT</pubDate>
            <atom:updated>2025-09-22T06:43:21.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>Caching is introduced in applications when high performance is in consideration and also if we have frequently accessed data in our use case; cache is the most probable solution. However, when our application needs to scale, cache consistency becomes the challenge. Distributed caching allows multiple instances to share cached data while preventing synchronization issues.</h3><p>Redis is an open source (BSD licensed), distributed, in memory key value store for cache and also it can be used as permanent data store and message broker. In this article we only elaborate it as a cache store.</p><h3>Sample Use Case</h3><p>We will implement a pay as you go insurance application based on IOT data. In this use case we need a cache store for our frequently accessed, less critical information that is latest data upload time to the cloud based on IOT metrics. We want to ensure that the iot data flow to the cloud flawlessly continues. We have machines sending this information to the cloud and some cloud software modules have also admin screens and there are batch operations that are done on the same tables at database level. We worry that this makes database a bottleneck for the application hence we want this data separated from the database.</p><p>This application is implemented with widely used Spring Boot Framework so we will show how to integrate Redis with Spring Boot projects.</p><h3>Demo Implementation</h3><p><strong>1.</strong>Redis Server</p><p>First, we will need a Redis Server to integrate to our project. It is very easy to set up in local if you have already Docker Desktop installed on local. Simply execute below command to create a Redis instance running locally on port 6379 in docker desktop.</p><p>docker run -p 6379:6379 –name redis-server -d redis</p><p><strong>2.</strong> Now that we have the Redis server on our local, let’s do spring boot configuration in order to integrate to this Redis server.</p><ul><li>Firstly, we will need two dependencies in order to do that.</li></ul><p>In our gradle.build file; we should add these two dependencies:</p><p>implementation’org.springframework.data:spring-data-redis:2.7.11′</p><p>implementation’io.lettuce:lettuce-core:6.2.5.RELEASE’</p><ul><li>In <strong>application.yaml</strong> file we will add Redis configuration :</li></ul><p>redis:</p><p>host:localhost</p><p>port:6379</p><p>defaultTimeout:500</p><ul><li>In order to keep these properties; we will map them to a POJO class for configuration:</li></ul><pre>import java.util.HashMap;<br>​<br>import java.util.Map;<br>​<br>import lombok.Data;<br>​<br>import org.springframework.boot.context.properties.ConfigurationProperties;<br>​<br>import org.springframework.stereotype.Component;<br>​<br>​<br>​<br>@Component<br>​<br>@ConfigurationProperties(prefix=&quot;redis&quot;)<br>​<br>@Data<br>​<br>public class RedisConfigProperties{<br>​<br>    private long defaultTimeout;<br>​<br>    private int port;<br>​<br>    private String host;<br>​<br>}</pre><p>We will need two beans to be able to use on Redis side; LettuceConnectionFactory bean for connection and RedisTemplate in order to be able to do operations on Redis cache: We will give connection information to the lettuce connection factory and serializers for RedisTemplate in order that Redis can resolve keys and values.</p><pre>import lombok.RequiredArgsConstructor;<br>​<br>import org.springframework.context.annotation.Bean;<br>​<br>import org.springframework.context.annotation.Configuration;<br>​<br>import org.springframework.data.redis.connection.RedisStandaloneConfiguration;<br>​<br>import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;<br>​<br>import org.springframework.data.redis.core.RedisTemplate;<br>​<br>import org.springframework.data.redis.serializer.StringRedisSerializer;<br>​<br>​<br>​<br>@Configuration<br>​<br>@RequiredArgsConstructor<br>​<br>public class RedisConfig {<br>​<br>​<br>​<br>private final RedisConfigProperties redisProperties;<br>​<br>​<br>​<br>@Bean<br>​<br>public RedisTemplate&lt;String,Object&gt; redisTemplate(){<br>​<br>    RedisTemplate redisTemplate=newRedisTemplate();<br>​<br>    redisTemplate.setConnectionFactory(redisConnectionFactory());<br>​<br>    redisTemplate.setKeySerializer(newStringRedisSerializer());<br>​<br>    redisTemplate.setHashKeySerializer(newStringRedisSerializer());<br>​<br>    redisTemplate.setValueSerializer(newStringRedisSerializer());<br>​<br>    redisTemplate.setEnableTransactionSupport(true);<br>​<br>    return redisTemplate;<br>​<br>}<br>​<br>​<br>​<br>@Bean<br>​<br>public LettuceConnectionFactory redisConnectionFactory(){<br>​<br>    RedisStandaloneConfiguration redisStandaloneConfiguration=newRedisStandaloneConfiguration();<br>​<br>    redisStandaloneConfiguration.setHostName(redisProperties.getHost());<br>​<br>    redisStandaloneConfiguration.setPort(redisProperties.getPort());<br>​<br>    return new LettuceConnectionFactory(redisStandaloneConfiguration);<br>​<br>}</pre><p><strong>3.</strong> Now lets pass to the actual implementation:</p><ul><li>Let’s create our domain objects:</li></ul><pre>import java.io.Serializable;<br>​<br>import java.util.List;<br>​<br>​<br>​<br>import lombok.AllArgsConstructor;<br>​<br>import lombok.Data;<br>​<br>import lombok.NoArgsConstructor;<br>​<br>​<br>​<br>@Data<br>​<br>@NoArgsConstructor<br>​<br>@AllArgsConstructor<br>​<br>public class ContractDataUploadInfo implements Serializable{<br>​<br>    private Long contractId;<br>​<br>    private List&lt;MetricDataUploadInfo&gt; metricDataUploadInfo;<br>​<br>}</pre><pre>import java.io.Serializable;<br>​<br>import java.time.LocalDateTime;<br>​<br>import lombok.Data;<br>​<br>​<br>​<br>@Data<br>​<br>public class MetricDataUploadInfo implements Serializable{<br>​<br>    private Long metricId;<br>​<br>    private LocalDateTime latestDataUploadTime;<br>​<br>}</pre><ul><li>We will create a repository for accessing Redis:</li></ul><pre>import com.siemens.ddx.contractmanagement.domain.model.ContractDataUploadInfo;<br>​<br>import java.util.List;<br>​<br>​<br>​<br>​<br>public interface ContractDataUploadInfoDao {<br>​<br>    ContractDataUploadInfo saveContractDataUploadInfo(ContractDataUploadInfo contractDataUploadInfo);<br>​<br>    ContractDataUploadInfo updateContractDataUploadInfo(<br>​<br>    Long contractId, ContractDataUploadInfo contractDataUploadInfo);<br>​<br>    boolean deleteContractDataUploadInfo(Long contractId);<br>​<br>    List&lt;ContractDataUploadInfo&gt; getAllContractsDataUploadInfo();<br>​<br>    ContractDataUploadInfo getContractDataUploadInfo(Long contractId);<br>​<br>}</pre><pre>@Slf4j<br>​<br>@Repository<br>​<br>public class ContractDataUploadInfoDaoImpl implements ContractDataUploadInfoDao{<br>​<br>private static final String HASH_KEY=&quot;UPLOAD_INFO&quot;;<br>​<br>private final RedisTemplate redisTemplate;<br>​<br>​<br>​<br>publicContractDataUploadInfoDaoImpl(RedisTemplateredisTemplate){<br>​<br>    this.redisTemplate=redisTemplate;<br>​<br>}<br>​<br>@Override<br>​<br>publicContractDataUploadInfosaveContractDataUploadInfo(ContractDataUploadInfocontractDataUploadInfo){<br>​<br>try{<br>​<br>    redisTemplate.opsForHash().put(HASH_KEY,contractDataUploadInfo.getContractId().toString(),contractDataUploadInfo);<br>​<br>    return contractDataUploadInfo;<br>​<br>}catch(Exception e){<br>​<br>    log.error(&quot;Error saving to the cache {} for contract {} &quot;, HASH_KEY, contractDataUploadInfo.getContractId().toString(), e);<br>​<br>    return null;<br>​<br>}<br>​<br>}<br>​<br>​<br>​<br>@Override<br>​<br>public ContractDataUploadInfo updateContractDataUploadInfo(<br>​<br>Long contractId, ContractDataUploadInfo contractDataUploadInfo){<br>​<br>try{<br>​<br>    redisTemplate.opsForHash().put(HASH_KEY,contractId,contractDataUploadInfo);<br>​<br>    return contractDataUploadInfo;<br>​<br>}catch(Exception e){<br>​<br>    log.error(&quot;Error updating the cache {} for contract {}&quot;, HASH_KEY, contractDataUploadInfo.getContractId().toString(), e);<br>​<br>    return null;<br>​<br>}<br>​<br>}<br>​<br>​<br>​<br>@Override<br>​<br>public boolean deleteContractDataUploadInfo(LongcontractId){<br>​<br>try{<br>​<br>    redisTemplate.opsForHash().delete(HASH_KEY,contractId.toString());<br>​<br>    return true;<br>​<br>}catch(Exception e){<br>​<br>    log.error(&quot;Error deleting the cache {} for contract {}&quot;, HASH_KEY,contractId.toString(),e);<br>​<br>    returnfalse;<br>​<br>}<br>​<br>}<br>​<br>​<br>​<br>@Override<br>​<br>publicList&lt;ContractDataUploadInfo&gt;getAllContractsDataUploadInfo(){<br>​<br>    List&lt;ContractDataUploadInfo&gt;contractDataUploadInfos;<br>​<br>    contractDataUploadInfos=redisTemplate.opsForHash().values(HASH_KEY);<br>​<br>    return contractDataUploadInfos;<br>​<br>}<br>​<br>​<br>​<br>@Override<br>​<br>public ContractDataUploadInfo getContractDataUploadInfo(LongcontractId){<br>​<br>    ContractDataUploadInfo contractDataUploadInfo=(ContractDataUploadInfo)redisTemplate.opsForHash().get(HASH_KEY,contractId.toString());<br>​<br>    return contractDataUploadInfo;<br>​<br>}<br>​<br>}</pre><p>Since we are implementing Rest API, we will create service and controller layers too.</p><pre>import com.siemens.ddx.contractmanagement.domain.model.ContractDataUploadInfo;<br>​<br>import java.util.List;<br>​<br>public interface ContractDataUploadInfoService{<br>​<br>    ContractDataUploadInfo saveContractDataUploadInfo(ContractDataUploadInfocontractDataUploadInfo);<br>​<br>    ContractDataUploadInfo updateContractDataUploadInfo(<br>​<br>    Long contractId,ContractDataUploadInfo contractDataUploadInfo);<br>​<br>    Boolean deleteContractDataUploadInfo(Long contractId);<br>​<br>    List&lt;ContractDataUploadInfo&gt;getAllContractsDataUploadInfo();<br>    ContractDataUploadInfo getContractDataUploadInfo(Long contractId);<br>​<br>}</pre><pre>import com.siemens.ddx.contractmanagement.domain.model.ContractDataUploadInfo;<br>​<br>import com.siemens.ddx.contractmanagement.domain.repository.ContractDataUploadInfoDao;<br>​<br>import com.siemens.ddx.contractmanagement.domain.service.ContractDataUploadInfoService;<br>​<br>import java.util.List;<br>​<br>import lombok.RequiredArgsConstructor;<br>​<br>import org.springframework.stereotype.Service;<br>​<br>​<br>​<br>@Service<br>​<br>@RequiredArgsConstructor<br>​<br>public class ContractDataUploadInfoServiceImpl implements ContractDataUploadInfoService{<br>​<br>    private final ContractDataUploadInfoDao contractDataUploadInfoDao;<br>​<br>@Override<br>​<br>public ContractDataUploadInfo saveContractDataUploadInfo(ContractDataUploadInfo contractDataUploadInfo){<br>​<br>    return contractDataUploadInfoDao.saveContractDataUploadInfo(contractDataUploadInfo);<br>​<br>}<br>​<br>@Override<br>​<br>public ContractDataUploadInfo updateContractDataUploadInfo(Long contractId,ContractDataUploadInfo contractDataUploadInfo){<br>​<br>    return contractDataUploadInfoDao.updateContractDataUploadInfo(contractId,contractDataUploadInfo);<br>​<br>}<br>​<br>@Override<br>​<br>public boolean deleteContractDataUploadInfo(Long contractId){<br>​<br>    return contractDataUploadInfoDao.deleteContractDataUploadInfo(contractId);<br>​<br>}<br>​<br>@Override<br>​<br>public List&lt;ContractDataUploadInfo&gt;getAllContractsDataUploadInfo(){<br>​<br>    return contractDataUploadInfoDao.getAllContractsDataUploadInfo();<br>​<br>}<br>​<br>@Override<br>​<br>public ContractDataUploadInfo getContractDataUploadInfo(Long contractId){<br>​<br>    return contractDataUploadInfoDao.getContractDataUploadInfo(contractId);<br>​<br>}<br>​<br>}</pre><p>Finally, we can implement the controller and we can test by calling the endpoints.</p><pre>import com.siemens.ddx.contractmanagement.domain.model.ContractDataUploadInfo;<br>​<br>import com.siemens.ddx.contractmanagement.domain.service.ContractDataUploadInfoService;<br>​<br>import io.swagger.v3.oas.annotations.tags.Tag;<br>​<br>import lombok.RequiredArgsConstructor;<br>​<br>import lombok.extern.slf4j.Slf4j;<br>​<br>import org.springframework.http.HttpStatus;<br>​<br>import org.springframework.http.ResponseEntity;<br>​<br>import org.springframework.validation.annotation.Validated;<br>​<br>import org.springframework.web.bind.annotation.GetMapping;<br>​<br>import org.springframework.web.bind.annotation.PathVariable;<br>​<br>import org.springframework.web.bind.annotation.PostMapping;<br>​<br>import org.springframework.web.bind.annotation.PutMapping;<br>​<br>import org.springframework.web.bind.annotation.RequestBody;<br>​<br>import org.springframework.web.bind.annotation.RequestMapping;<br>​<br>import org.springframework.web.bind.annotation.RestController;<br>​<br>​<br>​<br>@Validated<br>​<br>@RestController<br>​<br>@RequestMapping(&quot;contract/contract-data-upload-info&quot;)<br>​<br>@Slf4j<br>​<br>@RequiredArgsConstructor<br>​<br>@Tag(<br>​<br>name=&quot;ContractManagementDataUploadInformationAPI&quot;,<br>​<br>description=&quot;Provides API to manage contracts upload data information&quot;)<br>​<br>public class ContractDataUploadInfoController{<br>​<br>    private final ContractDataUploadInfoService contractDataUploadInfoService;<br>​<br>​<br>@PostMapping<br>​<br>publicResponseEntity&lt;ContractDataUploadInfo&gt; createContractDataUploadInfo(<br>​<br>@RequestBody ContractDataUploadInfocontractDataUploadInfo){<br>​<br>    log.debug(&quot;saving contract data upload information to the cache for contract {}&quot;, contractDataUploadInfo.getContractId());<br>​<br>    ContractDataUploadInfo savedContractDataUploadInfo=contractDataUploadInfoService.saveContractDataUploadInfo(contractDataUploadInfo);<br>​<br>    log.debug(&quot;contract data upload information is saved to the cache for contract { }&quot;, contractDataUploadInfo.getContractId());<br>​<br>    return new ResponseEntity&lt;ContractDataUploadInfo&gt;(savedContractDataUploadInfo, HttpStatus.CREATED);<br>​<br>}<br>​<br>@PutMapping(value=&quot;/{contractId}&quot;)<br>​<br>public ResponseEntity&lt;ContractDataUploadInfo&gt; updateContractDataUploadInfo(<br>​<br>@PathVariable Long contractId,@RequestBody ContractDataUploadInfo contractDataUploadInfo){<br>​<br>    log.debug(&quot;updating contract data upload information to the cache for contract { }&quot;, contractDataUploadInfo.getContractId());<br>​<br>    ContractDataUploadInfo  updatedContractDataUploadInfo=contractDataUploadInfoService.updateContractDataUploadInfo(contractId,contractDataUploadInfo);<br>​<br>    log.debug(&quot;contract data upload information is updated to the cache for contract { }&quot;,<br>​<br>    contractDataUploadInfo.getContractId());<br>​<br>    return new ResponseEntity&lt;ContractDataUploadInfo&gt;(updatedContractDataUploadInfo, HttpStatus.OK);<br>​<br>}<br>​<br>@GetMapping(value=&quot;/{contractId}&quot;)<br>​<br>public ResponseEntity&lt;ContractDataUploadInfo&gt; getContractDataUploadInfo(<br>​<br>@PathVariable Long contractId){<br>​<br>    log.debug(&quot;getting contract data upload information from the cache for contract { } &quot;, contractId);<br>​<br>    ContractDataUploadInfo contractDataUploadInfo=contractDataUploadInfoService.getContractDataUploadInfo(contractId);<br>​<br>    log.debug(<br>​<br>    &quot;contract data upload information is returned from the cache for contract { }&quot;, contractId);<br>​<br>    return new ResponseEntity&lt;ContractDataUploadInfo&gt;(contractDataUploadInfo, HttpStatus.OK);<br>​<br>}<br>​<br>}</pre><p>Finally, we are here: Here is the result for the post request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Jps3xJW4GJi7xpiLDUHCA.png" /></figure><p>And for the get request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Jps3xJW4GJi7xpiLDUHCA.png" /></figure><p><strong>In this writing we saw the basic steps for how to enable Redis Caching in our spring boot projects. Thanks for reading and lets see in other writings 🙂</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b11962190e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Security With LDAP Authentication]]></title>
            <link>https://medium.com/turkcell/spring-security-with-ldap-authentication-9e8a6bf3004c?source=rss-6b70d968d4dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e8a6bf3004c</guid>
            <category><![CDATA[spring-security]]></category>
            <category><![CDATA[ldap-authentication]]></category>
            <dc:creator><![CDATA[Dilek Karadaş Mataracı]]></dc:creator>
            <pubDate>Thu, 02 Dec 2021 10:26:19 GMT</pubDate>
            <atom:updated>2022-01-14T11:27:10.947Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*36EPEQ30Z8ezL-E1.jpg" /></figure><p>In real-world applications on production systems; security is a top concern. This security concern is separated into two: Authentication and Authorization. Authentication mainly focuses on who can access to the application and authorization focuses on who can access which resources based on their authorities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/0*seZJE7ljZJhlIuqZ.png" /></figure><p>In this article I will share my experience with Spring Security on a demo purpose application of which source code is available on Github. In this project, I used LDAP Authentication method for authentication. For the token generation mechanism, I used a private/public RSA key method. Private key is used for token generation and public key is used for token validation.</p><p>The aim of the project is to return a jwt token to the login user and the user will use this token to access resources in subsequent requests. The demo application offers two rest endpoints: one is for the authentication mechanism to take place (/auth-server) and the other is a representative rest resource (/resource). Anyone can access the “/auth-server” endpoint, but the access is restricted to the “/resource” endpoint. When the user logs into the system; there will be a rest call to the “/auth-server” endpoint for LDAP authentication. For successful authentication, there will be a jwt token in the response. The second rest call will be to the actual resource endpoint “/resource” with the token in the header as an Authentication object. We will see how this is done in the codebase.</p><p>It is very simple to enable Spring Security in your projects. You can do that by only adding a few dependencies. Let’s start to examine our demo application to see how things are done.</p><p>First; the two dependencies below will be added to the pom.xml to enable Spring Security. You can do this also when generating the project structure in spring initializer by adding Spring Security Component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75930ac3db41bc8e1436ddae036028d6/href">https://medium.com/media/75930ac3db41bc8e1436ddae036028d6/href</a></iframe><p>Apart from these, we need to add additional dependencies for LDAP. Spring gives us the opportunity to use an embedded LDAP server.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10a879ee22b58a067fffe1edce8d21f9/href">https://medium.com/media/10a879ee22b58a067fffe1edce8d21f9/href</a></iframe><p>Security configuration is done based on a configuration file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ceb103f0987e8f8f8d7669d588fa345/href">https://medium.com/media/5ceb103f0987e8f8f8d7669d588fa345/href</a></iframe><p>The @EnableWebSecurity annotation is used for enabling spring web security. Configuration class must extend from Spring’s WebSecurityConfigurerAdapter class. First, the configure method is needed for defining the authentication method. The second configure method is to define security properties. For authentication, I created a custom LdapAuthenticationProvider class. Inside the second configure method, we are authorizing any request to the endpoint “/auth-server,” but the other endpoints should be authenticated first. We disable CSRF and we use an HTTP basic authentication.</p><p>For an embedded LDAP server, in the application.properties file we should define some properties:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3141961a0c06570bf6db69130efc06f/href">https://medium.com/media/f3141961a0c06570bf6db69130efc06f/href</a></iframe><p>We will read the LDAP structure from a LDIF file(ldap.ldif); LDAP server’s port will be 8389; the root directory will be dc=springframework,dc=org.</p><p>Below is the custom LDAP authentication provider class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0321c98fa13435c48ae34d8354173ee7/href">https://medium.com/media/0321c98fa13435c48ae34d8354173ee7/href</a></iframe><p>The first LdapContext is prepared after an EqualsFilter operation is done based on the uid(username). If a match happens with the correct password, then an Authentication object is prepared and returned. Otherwise, it returns null.</p><p>After successful authentication, the JWTTokenProvider class prepares a token with below method: <em>generateToken:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b9a98d0bfc51ee637630a1b721eb088/href">https://medium.com/media/9b9a98d0bfc51ee637630a1b721eb088/href</a></iframe><p>I used private/public RSA key method to generate the token. I generated a private key with the OpenSSL genrsa command and put this private key to a resource file as “private.key” in/resources folder. The jwt token is prepared based on this private key in generateToken method. Also, an expiration time can be set to the token with the setExpiration method.</p><p>In postman, we can call the rest endpoints as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BBqsZjXwGO8ZaSXk.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KniqH0Mrc6bsVT3k.png" /></figure><p>Thanks for reading!</p><p>You can find the source code at <a href="https://github.com/dileque/SpringSecurityDemo">Github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e8a6bf3004c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turkcell/spring-security-with-ldap-authentication-9e8a6bf3004c">Spring Security With LDAP Authentication</a> was originally published in <a href="https://medium.com/turkcell">turkcell</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MicoServices Integration -Aggregators]]></title>
            <link>https://medium.com/@dilekkaradas/micoservices-integration-aggregators-4aab66fb5afe?source=rss-6b70d968d4dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4aab66fb5afe</guid>
            <category><![CDATA[aggregation]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <dc:creator><![CDATA[Dilek Karadaş Mataracı]]></dc:creator>
            <pubDate>Sat, 07 Mar 2020 08:59:24 GMT</pubDate>
            <atom:updated>2020-03-07T08:59:24.836Z</atom:updated>
            <content:encoded><![CDATA[<p>While the usage area of MicroService architecture continues to expand; there stands the problems that need to be solved. MicroService design patterns also offer general, reusable solutions to these problems. In general, the applications are basically based on data, as a result data consistency and management of data pose a challenge. In this article, I will talk about AGGREGATION design patterns developed for the need of transmitting data to the application layer. Since microservices have their own database(most of the time), aggregation patterns give an idea of what can be done to obtain composite data that more than one service can offer. It is not possible to use old style table joins in order to be compatible with the encapsulation principle.</p><p>At this point, we can talk about two patterns:</p><h3>API COMPOSITION</h3><p>This pattern raises the need for a new composite service. For example, if we need the information of the customer’s orders, we first query the Customer microservice, and then we query the order microservice to obtain the enriched data. It is essential to always have a maintenance cost in such a composite service. The API COMPOSITION pattern solves below problems:</p><ul><li>Different clients may have different access privileges for the same data</li><li>Different clients may need different formats of the same data, creating the need to convert the data.</li></ul><p>This pattern is implemented as API Gateway. API Gateway can be created programmatically or it is available ready to use from some vendors.</p><p>API Gateway is useful for not only in blending the data of multiple services but also in the following areas:</p><ul><li>Creates an entry point for microservices and defines APIs.</li><li>It can work like a proxy that will forward requests to the relevant service.</li><li>Can convert between various protocols</li><li>Authentication / Authorization</li></ul><h3>AGGREGATOR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/0*WIzonDyu1lgGFEM8.png" /></figure><h3>Aggregator Pattern</h3><p>In MicroService architecture; since there is the principle of separating our large modules and our monolith applications into atomic parts that can work autonomously and independently, it is possible that we will need queries that a few microservices will come together and return results. For this purpose, the aggregator microservice can be written, and this aggregator microservice collects data from multiple microservices and runs the workflows that must be run, if any, and returns the results to the consumer. The reason we create the aggregate pattern especially by making composite service is that it is necessary to apply a business workflow while preparing the result data.</p><h4>To Conclude;</h4><p>We use aggregates in case we need to apply business rules on the composite data gathered from multiple services; otherwise API gateways are sufficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aab66fb5afe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Integration Patterns]]></title>
            <link>https://medium.com/microservices-integration-patterns/microservice-integration-patterns-d88917862436?source=rss-6b70d968d4dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d88917862436</guid>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Dilek Karadaş Mataracı]]></dc:creator>
            <pubDate>Tue, 10 Dec 2019 08:40:28 GMT</pubDate>
            <atom:updated>2019-12-10T08:40:28.977Z</atom:updated>
            <content:encoded><![CDATA[<h3>SAGA PATTERN AND METHODS OF IMPLEMENTATION</h3><p>Since the application of MicroService architectures is expanding day to day, it is becoming much more important to ensure successful integrations between these micro services.</p><p>There are some issues to consider while designing these integration patterns:</p><ol><li>Partial error handling : MicroServices are single responsibility units but business transactions require more than one of these units. If one unit(it is called a local transaction) fails, the system must be designed to do its rollback actions(it is called compensation transaction) accordingly.</li><li>Manage the situations where we need to collect data from multiple services: Micro services only have their entity data; when we need data from multiple entities, we need to have proper integration principles.</li><li>Testing requirements of the system design: Some patterns are more appropriate for testing purposes while some others don’t.</li><li>Also the organization(the company) structure is a key point : Agile/Waterfall working principles of the organization is also a key point for the architectural design.</li></ol><p>MicroService Architecture depends on Database per Service principle. On the top of that principle there is<em> SAGA pattern</em> that can be applied to ensure integrity of distributed transactions because Database per Service principle results in a context that we need to synchronize these databases.</p><p>SAGA Pattern depends on consecutive local transactions. It can be applied in two ways:</p><h3>Choreography based SAGA pattern:</h3><p>In this method, each local transaction publishes an event when its job is done. The other local transaction that receives this event performs the appropriate behavior. The work is finished when all the local transactions are done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/53/0*vjoWi3nwcr4yasAa" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lPAiZ2LyFXns18jv.jpeg" /></figure><p>Choreography based SAGA pattern</p><p>In choreography based SAGA , the process is managed by local transactions itself. This conforms the principle of intelligent endpoints and dummy communication channels.</p><p>The benefits of this method are as follows:<br>1. Easy to implement<br>2. Appropriate if the number of local transactions is small.<br>3. Loosely coupled endpoints.<br>4. Suitable for agile organizations.</p><p>There are some drawbacks of the method:</p><ol><li>It gets very complicated when the number of the local transactions increase.</li><li>Cyclic dependency may occur between services.</li></ol><h3>Orchestration based SAGA pattern:</h3><p>In this method, there is an intelligent endpoint(a separate service that performs orchestration) that coordinates the whole process. It manages which service will perform when. If one of the local transactions fails for some reason, the Orchestrator is also responsible for rollback of the previously performed transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/53/0*rei07XHK2vPMeZPZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*Ume8lq6aTx_uY1Y7.jpeg" /></figure><p>Orchestration based SAGA Pattern</p><p>The benefit of this method are:</p><ol><li>Easy to implement</li><li>Easy to understand and maintain</li><li>Complexity is not an issue when local transactions’ count dramatically increase</li></ol><p>And the drawbacks are:</p><ol><li>This method creates a situation that the communication channel becomes intelligent and the endpoints become dummy.</li><li>All the business logic is implemented inside the orchestrator. So the orchestrator becomes the monolith.</li></ol><p>Which method to consider is determined by the needs of the system and the organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d88917862436" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microservices-integration-patterns/microservice-integration-patterns-d88917862436">Microservice Integration Patterns</a> was originally published in <a href="https://medium.com/microservices-integration-patterns">MicroServices Integration Patterns</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Integration Patterns]]></title>
            <link>https://medium.com/@dilekkaradas/microservice-integration-patterns-68a1428c9aff?source=rss-6b70d968d4dd------2</link>
            <guid isPermaLink="false">https://medium.com/p/68a1428c9aff</guid>
            <category><![CDATA[integration-microservice]]></category>
            <category><![CDATA[saga-pattern]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Dilek Karadaş Mataracı]]></dc:creator>
            <pubDate>Sat, 07 Dec 2019 12:32:46 GMT</pubDate>
            <atom:updated>2019-12-07T12:56:26.676Z</atom:updated>
            <content:encoded><![CDATA[<h3>SAGA PATTERN AND METHODS OF IMPLEMENTATION</h3><p>Since the application of MicroService architectures is expanding day to day, it is becoming much more important to ensure successful integrations between these micro services.</p><p>There are some issues to consider while designing these integration patterns:</p><ol><li>Partial error handling : MicroServices are single responsibility units but business transactions require more than one of these units. If one unit(it is called a local transaction) fails, the system must be designed to do its rollback actions(it is called compensation transaction) accordingly.</li><li>Manage the situations where we need to collect data from multiple services: Micro services only have their entity data; when we need data from multiple entities, we need to have proper integration principles.</li><li>Testing requirements of the system design: Some patterns are more appropriate for testing purposes while some others don’t.</li><li>Also the organization(the company) structure is a key point : Agile/Waterfall working principles of the organization is also a key point for the architectural design.</li></ol><p>MicroService Architecture depends on Database per Service principle. On the top of that principle there is<em> SAGA pattern</em> that can be applied to ensure integrity of distributed transactions because Database per Service principle results in a context that we need to synchronize these databases.</p><p>SAGA Pattern depends on consecutive local transactions. It can be applied in two ways:</p><h4>Choreography based SAGA pattern:</h4><p>In this method, each local transaction publishes an event when its job is done. The other local transaction that receives this event performs the appropriate behavior. The work is finished when all the local transactions are done.</p><figure><img alt="Choreography based SAGA pattern" src="https://cdn-images-1.medium.com/max/1024/1*HuRO_pPeJa-vegaqJ_XxwQ.jpeg" /><figcaption>Choreography based SAGA pattern</figcaption></figure><p>In choreography based SAGA , the process is managed by local transactions itself. This conforms the principle of intelligent endpoints and dummy communication channels.</p><p>The benefits of this method are as follows:<br> 1. Easy to implement<br> 2. Appropriate if the number of local transactions is small.<br> 3. Loosely coupled endpoints.<br> 4. Suitable for agile organizations.</p><p>There are some drawbacks of the method:</p><ol><li>It gets very complicated when the number of the local transactions increase.</li><li>Cyclic dependency may occur between services.</li></ol><h4>Orchestration based SAGA pattern:</h4><p>In this method, there is an intelligent endpoint(a separate service that performs orchestration) that coordinates the whole process. It manages which service will perform when. If one of the local transactions fails for some reason, the Orchestrator is also responsible for rollback of the previously performed transactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*DqzA1PWBEg3FlPf6jUO1eA.jpeg" /><figcaption>Orchestration based SAGA Pattern</figcaption></figure><p>The benefit of this method are:</p><ol><li>Easy to implement</li><li>Easy to understand and maintain</li><li>Complexity is not an issue when local transactions’ count dramatically increase</li></ol><p>And the drawbacks are:</p><ol><li>This method creates a situation that the communication channel becomes intelligent and the endpoints become dummy.</li><li>All the business logic is implemented inside the orchestrator. So the orchestrator becomes the monolith.</li></ol><p>Which method to consider is determined by the needs of the system and the organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68a1428c9aff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>