<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="295323" data-post-id="295323">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="scoop" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/scoop/120/31638_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  scoop
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks!</p>
<p>I’ll make sure to post any insights here for the community <img src="https://forum.elixirforum.com/images/emoji/apple/slightly_smiling_face.png?v=15" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="295323" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-setup-azure-ad-sso-using-samly/52545/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-295323" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="295323"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="334545" data-post-id="334545">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="adamverb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/adamverb/120/35405_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  adamverb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="scoop" data-post="10" data-topic="52545">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/scoop/48/31638_2.png" class="avatar"> scoop:</div>
<blockquote>
<p>ou manage to finally integ</p>
</blockquote>
</aside>
<p>fyi you can set up Samly SSO with Azure AD SSO (Microsoft Entra).  however i first set up locally got it working with simplesamlphp, then moved to staging environment and got it working with simplesamlphp as its just easier for me as i’ve used it before.  then after i got that working fine i set up Azure AD which is Entra now.  Took me roughly 2 days to get it fully working with signing/encryption at that point.  i suggest doing this yourself instead of with a client as lots of iteration was needed for my goals, mostly due to a single Samly setting.</p>
<p>i started with this.  i wanted store to be session instead of ETS and i used a custom key, you can use the key to delete the session to help logout (default key is “samly_assertion”)</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  config :samly, Samly.State,
    store: Samly.State.Session,
    opts: [key: "custom_key_here"]
</code></pre>
<p>can use key like this to delete from session</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  |&gt; delete_session(:samly_assertion)
  |&gt; Guardian.Plug.sign_out()
</code></pre>
<p>as for rest of samly settings pretty simple honestly cept for <code>signed_envelopes_in_resp</code> if you want to use encryption on Azure, that needs to be false or you get <code>:bad_digest</code> error.  but here is what i have, most are env vars for me but i’ll change for here to make simpler.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  config :samly, Samly.Provider,
    idp_id_from: :path_segment,
    service_providers: [
      %{
        id: "sp1",
        entity_id: "urn:myapp.com:samly_sp",
        certfile: "/app/saml_sp_cert_file.pem",
        keyfile: "/app/saml_sp_key_file.pem",
        contact_name: "Administrator",
        contact_email: "myemail@mycompany.com,
        org_name: "mycompany",
        org_displayname: "mycompany",
        org_url: "https://myapp.com"
      }
    ],
    identity_providers: [
      %{
        id: "idp1",
        sp_id: "sp1",
        base_url: "https://myapp.com/sso",
        metadata_file: "/app/lib/my_app-1.0.0/priv/metadata/idp_metadata_azure_testing.xml",
        allow_idp_initiated_flow: false,
        use_redirect_for_req: false,
        sign_requests: true,
        sign_metadata: true,
        signed_assertion_in_resp: true,
        signed_envelopes_in_resp: false
      }
    ]
</code></pre>
<p>on the Azure (Entra) side wanna be here <a href="https://entra.microsoft.com/" rel="noopener nofollow ugc">https://entra.microsoft.com/</a>.<br>
Identifier (Entity ID) = entity_id from sp1<br>
Reply URL (Assertion Consumer Service URL) = <code>https://myapp.com/sso/sp/consume/idp1</code></p>
<p>then in SAML Certificates set <code>Signing Option</code> to sign both response and assertion.  this is how i wanted it, there is no option for neither, so not sure if that’s possible or not.</p>
<p>then in Token encryption upload your public cert if you want to enable encryption, if the status is Active then encryption is on if its Inactive then encryption is off.  on the Samly side there is no turning encryption on/off thats just on the Entra side by this Active/Inactive cert.</p>
<p>NOTE: Obviously change anything you want also change all my app/company specific stuff.<br>
NOTE2: There are a few more IDP settings which i don’t have here since i didn’t need them, but check out <a href="https://github.com/dropbox/samly" class="inline-onebox" rel="noopener nofollow ugc">GitHub - dropbox/samly: Elixir Plug library to enable SAML 2.0 SP SSO in Phoenix/Plug applications. · GitHub</a> for them all.<br>
NOTE3: I left out some minor stuff like attribute claims and code implementation for logout/in as that should be pretty straight forward, if your attempting this.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="334545" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-setup-azure-ad-sso-using-samly/52545/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-334545" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="334545"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>