﻿
{"id":18458,"date":"2020-10-19T22:30:31","date_gmt":"2020-10-19T22:30:31","guid":{"rendered":"https:\/\/www.gencayyildiz.com\/blog\/?p=18458"},"modified":"2020-10-19T22:30:31","modified_gmt":"2020-10-19T22:30:31","slug":"identityserver4-yazi-serisi-5-discovery-endpoint","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/identityserver4-yazi-serisi-5-discovery-endpoint\/","title":{"rendered":"IdentityServer4 Yaz\u0131 Serisi #5 \u2013 Discovery Endpoint"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>IdentityServer4 framework&#8217;\u00fc, kendisiyle belli ba\u015fl\u0131 ihtiya\u00e7lara istinaden ileti\u015fim kurulabilmesi i\u00e7in hali haz\u0131rda mevcut olan endpointler bar\u0131nd\u0131rmaktad\u0131r. Bizler bu endpointler vas\u0131tas\u0131yla sistemin getirisi olan baz\u0131 i\u015flevlere eri\u015febilmekte ve ihtiya\u00e7 do\u011frultusunda kullanabilmekteyiz. Bu endpoint&#8217;lere misal olarak; yaz\u0131 serimizin 3. makalesi olan <a href=\"https:\/\/www.gencayyildiz.com\/blog\/identityserver4-yazi-serisi-3-client-credentials\/\" rel=\"noopener noreferrer\" target=\"_blank\">Client Credentials<\/a> ba\u015fl\u0131kl\u0131 i\u00e7eri\u011fimizde, client&#8217;lar\u0131n Auth Server&#8217;dan token talep edebilmesi i\u00e7in kulland\u0131\u011f\u0131 <code>\/connect\/token<\/code> endpoint&#8217;ini verebiliriz. Esas\u0131nda bu endpoint IdentityServer4 taraf\u0131ndan bizlere hali haz\u0131rda verilmi\u015f olan ve literat\u00fcrde &#8216;Token Endpoint&#8217; olarak ge\u00e7en bir endpoint&#8217;tir. Bu i\u00e7eri\u011fimizde IdentityServer4&#8217;\u00fcn bizlere sundu\u011fu bu endpoint&#8217;lerden sistemi ve sistemin nice \u00f6zelliklerini ke\u015ffetmemizi sa\u011flayacak olan Discovery Endpoint&#8217;ini inceliyor olaca\u011f\u0131z.<\/p>\n<blockquote><p><em style=\"color:purple;\">Discovery Endpoint, IdentityServer4&#8217;\u00fcn sundu\u011fu \u00f6zellikleri ke\u015ffedebilmek i\u00e7in kullan\u0131lan bir endpoint&#8217;tir.<\/em><\/p><\/blockquote>\n<p><strong>Discovery Endpoint&#8217;e nas\u0131l istekte bulunulabilir?<\/strong><br \/>\nKullan\u0131lan IdentityServer4 mimarisinin \u00f6zelliklerini ke\u015ffedebilmek i\u00e7in<br \/>\n<code style=\"color:red;font-size:14px;\"><strong>\/.well-known\/openid-configuration<\/strong><\/code> endpoint&#8217;ine istek g\u00f6nderilmesi yeterlidir. Bu endpoint, Dicovery Endpoint&#8217;e kar\u015f\u0131l\u0131k gelmektedir.<\/p>\n<p><a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint.jpg\" alt=\"IdentityServer4 Yaz\u0131 Serisi #5 \u2013 Discovery Endpoint\" width=\"926\" height=\"1154\" class=\"aligncenter size-full wp-image-18467\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint.jpg 926w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-241x300.jpg 241w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-822x1024.jpg 822w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-768x957.jpg 768w\" sizes=\"auto, (max-width: 926px) 100vw, 926px\" \/><\/a><br \/>\n\u0130lgili endpoint&#8217;e &#8216;GET&#8217; iste\u011fi yap\u0131ld\u0131\u011f\u0131 taktirde yukar\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi hedef IdentityServer4 uygulamas\u0131n\u0131n t\u00fcm bilgileri taraf\u0131m\u0131za gelmektedir. Bu bilgiler \u00fczerinden; ilerideki makalelerde tek tek ele alaca\u011f\u0131m\u0131z di\u011fer haz\u0131r endpoint&#8217;lere(ye\u015fil), Auth Server&#8217;\u0131n destekledi\u011fi yetkilere(scopes_supported)(mavi), hangi yetki\/eri\u015fim tiplerini destekledi\u011fine(grant_types_supported)(mor) yahut desteklenen d\u00f6n\u00fc\u015f t\u00fcrlerine(response_types_supperted)(kahverengi) gibi bir\u00e7ok \u00f6zelli\u011fe eri\u015febilmekteyiz.<\/p>\n<p>Ayr\u0131ca yeri gelmi\u015fken yukar\u0131da referans edilen \u00f6nceki makaledeki(<a href=\"https:\/\/www.gencayyildiz.com\/blog\/identityserver4-yazi-serisi-3-client-credentials\/\" rel=\"noopener noreferrer\" target=\"_blank\">Client Credentials<\/a>) bir noktay\u0131 ilgilendiren nazik bir hususa de\u011finmekte fayda vard\u0131r. Discovery Endpoint&#8217;e yap\u0131lan istek neticesinde gelen result&#8217;un ikinci \u00f6zelli\u011fi olan &#8216;jwks_uri&#8217; de\u011ferine g\u00f6z atarsan\u0131z e\u011fer API&#8217;lar\u0131n public key almak i\u00e7in IdentityServer4 uygulamas\u0131nda istek att\u0131klar\u0131 endpoint&#8217;i g\u00f6receksiniz. Evet&#8230; Bu endpoint&#8217;e bizler manuel istek g\u00f6ndermesekte; API&#8217;lar, client&#8217;tan gelen token&#8217;\u0131n Auth Server&#8217;dan gelip gelmedi\u011fini do\u011frulayabilmek i\u00e7in ilgili token&#8217;da ki private key de\u011ferine kar\u015f\u0131l\u0131k Auth Server&#8217;dan bu endpoint ile public key&#8217;i talep etmektedirler. Gelen public key ile private key check edilip, do\u011frulamay\u0131 ger\u00e7ekle\u015ftirirler&#8230; Dolay\u0131s\u0131yla API&#8217;\u0131n otomatik bir \u015fekilde bu endpoint&#8217;e yapt\u0131\u011f\u0131 iste\u011fi bizler manuel olarak icra edersek do\u011fal olarak public key&#8217;i g\u00f6zlemleme f\u0131rsat\u0131 elde edebiliriz.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-1.jpg\" alt=\"IdentityServer4 Yaz\u0131 Serisi #5 \u2013 Discovery Endpoint\" width=\"912\" height=\"470\" class=\"aligncenter size-full wp-image-18474\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-1.jpg 912w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-1-300x155.jpg 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2020\/10\/IdentityServer4-Yazi-Serisi-5-\u2013-Discovery-Endpoint-1-768x396.jpg 768w\" sizes=\"auto, (max-width: 912px) 100vw, 912px\" \/><\/a><br \/>\nG\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere public key&#8217;i elde edebilmekte ve g\u00f6r\u00fcp, inceleyebilmekteyiz. <em><strong>Hoca public key&#8217;e biz bu \u015fekilde ula\u015fabiliyorsak, kolunu sallayan elalem&#8217;de ula\u015famaz m\u0131?<\/strong><\/em> diye serzeni\u015fte oldu\u011funuzu duyar gibiyim&#8230; Bu sorunuza cevab\u0131m <em>-Evet, ula\u015fabilir \ud83d\ude42<\/em> olacakt\u0131r. <strong><em>Yahu bu g\u00fcvenlik a\u00e7\u0131\u011f\u0131 \u015fey etmez mi?<\/em><\/strong> <em>-Etmez. public key&#8217;in 3. \u015fah\u0131slar taraf\u0131ndan elde edilmesi hi\u00e7bir risk ta\u015f\u0131mayacak, tehlike arz etmeyecektir. M\u00fchim olan private key&#8217;in k\u00f6t\u00fc niyetli ki\u015filerin eline ge\u00e7me ihtimalidir.<\/em> Bu durumu \u015f\u00f6yle \u00f6rneklendirip, a\u00e7\u0131kl\u0131\u011fa kavu\u015fturabiliriz; H\u0131rs\u0131z her ne kadar kilidinize ula\u015fsa dahi(public key), anahtar(private key) sizde oldu\u011fu s\u00fcrece s\u0131k\u0131nt\u0131 olmayacakt\u0131r&#8230;<\/p>\n<p>\u0130lgilenenlerin faydalanmas\u0131 dile\u011fiyle&#8230;<br \/>\nSonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, IdentityServer4 framework&#8217;\u00fc, kendisiyle belli ba\u015fl\u0131 ihtiya\u00e7lara istinaden ileti\u015fim kurulabilmesi i\u00e7in hali haz\u0131rda mevcut olan endpointler bar\u0131nd\u0131rmaktad\u0131r. Bizler bu endpointler vas\u0131tas\u0131yla sistemin getirisi olan baz\u0131 i\u015flevlere eri\u015febilmekte ve ihtiya\u00e7 do\u011frultusunda kullanabilmekteyiz. Bu endpoint&#8217;lere misal&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":18168,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3826],"tags":[3857,3827,3858,3859],"class_list":["post-18458","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-identityserver4","tag-discovery-endpoint","tag-identityserver4","tag-identityserver4-discovery-endpoint","tag-token-endpoint"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/18458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=18458"}],"version-history":[{"count":17,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/18458\/revisions"}],"predecessor-version":[{"id":18477,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/18458\/revisions\/18477"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/18168"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=18458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=18458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=18458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}