handnot2

handnot2

Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.

This library uses Erlang esaml to provide
plug enabled routes. Use of esaml provides the following capabilities:

  • SP initiated login
  • SP initiated logout
  • IdP initiated logout

This is tested with SimpleSAMLphp. There is a fairly detailed README.md file to help you get started. There are two companion Repos:

  • samly_simplesaml - Use this to create your own SAML IdP for development purpose when working with Samly
  • samly_howto - This is a sample Phoenix application that shows how to use Samly

The readme file has an FAQ section that covers the following:

  • How to setup a SAML 2.0 IdP for development purposes
  • Sample Phoenix application that shows how to use Samly
  • How to register the service provider with IdP
  • How to enable Samly in my application

Feedback and contributions are appreciated.

Showing Posts 1 to 10

handnot2

handnot2 OP

Samly library version v0.8.0 introduces support for working with multiple Identity Providers (earlier versions were limited to working with only one IdP).

There are two companion Repos:

  • samly_simplesaml - Docker based self-hosted SimpleSAMLPhp Identity provider for development purposes
  • samly_howto - A simple Phoenix application that demonstrates how to SAML enable your application. This will show the SAML assertions from the IdP upon success end-user authentication. It is mostly pre-configured to work with samly_simplesaml. But you can change the configuration to point to any SAML provider.

The Samly documentation has been updated as well.

https://github.com/handnot2/samly

https://github.com/handnot2/samly_howto

https://github.com/handnot2/samly_simplesaml

handnot2

handnot2 OP

Samly v0.8.4 and esaml v3.3.0

Now works with Shibboleth IdP (in addition to SimpleSAMLPhp). Here are some screenshots showing the login and consent flows interacting with a self-hosted Shibboleth IdP setup.

Login portion in a Samly enabled phoenix app

Shibboleth Login Page

Shibboleth Consent Page

Back to the Phoenix app - Showing the SAML assertion Attributes

boddhisattva

boddhisattva

@handnot2 Thank you for your work as part of the Samly library. I’m curious, how easy would it be for one to integrate this with Coherence or Guardian . Do you have any thoughts on that or any open source projects where you’ve tried out this kind of an integration ?

handnot2

handnot2 OP

Samly is used to enable SAML authentication in your application talking to a SAML provider. Such SAML providers typically would include the capabilities that Coherance provides. Lot of Universites use Shibboleth as their SAML provider and they already would have the user registration, password recovery, notification etc built-in or integrated. The same goes for cloud systems such as OneLogin, Azure and many internal corporate Identity systems. My understanding is that you would need Coherence when you want to manage these capabilities in your application itself. If that is your requirement, you probably don’t want SAML.

If your question is more about how easy it is to integrate Samly in your application, check out the README file. It is very easy. The usual hickups are related to making sure you have the correct SAML provider endpoint information, certificates, whether signing/encryption are used or not and making sure that the config settings are correct.

As a recommended practice, one should clone the following How-to repo, make config changes in that repo (dev.exs) pointing to the SAML provider you want to work with and make sure you are able to login/logout and get the SAML assertions correct. All this without making any other code changes.

https://github.com/handnot2/samly_howto

The screenshots shown earlier were from this samly_howto Phoenix app. Once this works, make the minimal changes required in your own Phoenix app with the config settings you had success with. You will have a better integration experience if you follow this model.

Hope this helps.

boddhisattva

boddhisattva

Hi @handnot2,

Thank you for your response.

I will look at Coherence in some more detail from my end to confirm if this is a SAML provider. I’m relatively new to SAML but will definitely explore further to understand it’s concepts better.

We’re trying to implement a Unified login service at our company currently. My requirement at a high level as part of this is to use the capabilities that Coherence provides, add Social sign in capabilities(planning to use - GitHub - danschultzer/coherence_assent: UNMAINTAINED - Add multi provider login to your Coherence Phoenix website · GitHub for Google and FB login) and also implement SSO(via Samly) in addition to this.

One of the use cases where SSO can be useful is, if a user is logged in to one app, we want that user to be auto logged in to the other app(both apps should be somehow tied to the same unified login service). That’s basically why we need SSO. At a high level, when we implement Social Sign in, We want the call back URL from a Provider like FB or Google to go to our authentication service(the unified login) which would return a session token to help keep the user signed in across multiple apps.

This is basically why I wanted to get more clarity on what do you think could be the feasibility of having all of this together in one application. Would it be possible for you to throw more light on whether one can potentially have all these capabilities in one application from your knowledge and experience?

I will also work towards following up on the above from my end.

Thank you for your time!

handnot2

handnot2 OP

Does anyone need instructions on how to setup a self-hosted Shibboleth Identity Provider installation (development setup) for use with Samly?

This would be similar to the samly_simplesaml - but pointing to an LDAP store for user authentication.

handnot2

handnot2 OP

Created a blog post on using samly. This includes instructions on setting up a self-hosted Shibboleth SAML Identity Provider that uses OpenLDAP.

handnot2

handnot2 OP

Samly V0.9.0 - IDP Initiated Login (aka IDP-First flow)

The authentication flow can now be started from an IDP. For example, cloud hosted SAML authentication providers such as OneLogin allow your application to be registered and be shown on an application portal/dashboard. The end user can login to the application portal click on your application Icon and be redirected/taken to your application.

Samly already supports the SP initiated login flow. In this model, the end user visits your application pages first. The login flow is initiated in your application, user authenticates and gets redirected back to your app.

Based on how your IDP is setup, you can get the user profile information along with any assigned “roles” in the SAML assertion. These are made available for you in the Plug/Phoenix connection. You can use any plug based authorization system to perform authorizations.

FYI. Samly is known to work with SimpleSAMLPhp, Shibboleth, OneLogin and other SAML 2.0 providers. If you work with other SAML providers, use the documentation and the blog entry above to do your own integration. Please share if you are able to integrate Samly with other SAML providers.

kip

kip

ex_cldr Core Team

Really impressed how you’re bringing Samly along. I have a project coming up that will absolutely benefit from your work. Part of that will be doing some work to integrate with SAP’s IDP. Thanks for the effort!

handnot2

handnot2 OP

Hope this can evolve to work with more providers. When you are ready, let us know how it goes with SAP IDP. Thanks.

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
rodloboz
I’ve started working on a new library to run SQL queries and do basic business intelligence. Think “Blazer for Elixir.” Currently it fe...
New

Other Trending Topics Top

mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
CodeSync
:microphone: ElixirConf 2026 - Call for Talks is open! We’re heading to Chicago :united_states: :round_pushpin: In person + virtual :d...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews