Jeremy Green on Authentication in Service-Oriented Architecture | RailsConf 2014

• UGtastic Archive

Jeremy Green on Authentication in Service-Oriented Architecture | RailsConf 2014

Loading this player connects your browser to Youtube.

Full Transcript Available
LIVE CC UGtastic Archive

Press play or click any turn in the transcript to start real-time synchronized playback...

📼 FROM THE UGTASTIC ARCHIVE (Recorded on-site at RailsConf 2014) Archival conversation with Jeremy Green on building authentication systems across service-oriented architectures, recorded at RailsConf Chicago 2014. Recorded during the 2009-2015 software craftsmanship and developer community movements, this archival interview captures early ideas, debates, and community organizing in real time. --- 🏛️ ORAL HISTORY RECORD: • Series: UGtastic Technical Conversation Archive (2009-2015) • Recorded: RailsConf 2014 (2014-04-22) • Guest: Jeremy Green • Interviewer: Mike Hall (UGtastic / https://www.just3ws.com) • Legacy UGtastic Archive ID: 382zofMYsFA 📖 FULL ARCHIVE & ORAL HISTORY: https://www.just3ws.com/interviews/ 🏷️ TOPICS: Jeremy Green, SOA, Authentication, Architecture, RailsConf 2014, Ruby, UGtastic, Mike Hall Restored and preserved by Mike Hall (https://www.just3ws.com)
The Guest

Unattributed voices

UGtastic archive transcript with speaker attribution pending

The Presentation


Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Hi, it's Mike with UTSC. I'm here at RailsConf 2014, and I'm standing here right now with Jeremy Green, who gave a talk earlier in the conference called, what was about SOA authentication, or authentication through SOA architectures. Thank you very much for taking the time to speak with me. So, since I just mangled the name of the talk, what was your talk and what was it about?
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
So, the title of the talk was Service-Oriented Authentication, and it was about how you allow users to have single sign-on between several kind of vertically split small services that all combine together to form a bigger service. The goal I was shooting for is to be able to do something like you see at Amazon, for instance, where even if you're going to log, whether you want to log into their store to buy a book, or whether you're trying to log into the AWS web tools, you always end up at the same login page. They don't have separate ones for each one of those. It's always the same authentication endpoint, and then you get redirected back to these different sub-domains.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And so, I wanted to build something like that in an app that I was working on, and so I spent some time figuring that out, and then just wanted to share what I learned and how I got it done with the Rails community. Was this, were you like implementing like an OAuth kind of thing? Yep, that's it exactly, OAuth 2. Okay, so you're one of the few people that understand it.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Well, I understand it enough to implement it. Using some gems, you know, I've at one point tried to implement a provider myself, and it's a little hairy, so having gems is nice. So, what did you use? So, there's a gem called DoorKeeper that you can drop onto an existing application that already has sign-in of some sort.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
In my case, I was using Devise as the sign-in method. So, you drop that into the application, and then that provides all of the OAuth provider functionality. And then, what I do is take OmniAuth and build a little tiny wrapper gem around it that has a dedicated strategy for delegating authentication to that provider, and also provides a few convenience methods for how you deal with, is this user signed in or not. And then, drop that gem into any of the services that I want to be able to authenticate to that provider.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Yeah, because I was going to ask them, like, okay, so once you've got that initial, like, okay, I have this system that I can authenticate with, then how do you start to have your architecture? So, you're saying that this gem will be able to configure it to know about the central authority? Yep, exactly. And so, like I mentioned, it has a few convenience methods in it, and, you know, one of them is just a login-required function that you can use as a before filter.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And so, any time that someone lands on one of these leaf services, and they need to get to a page that's protected, that filter kicks in, you know, you can assign that before filter on the controller action, say, right, before filter login-required. And then that checks the user session on the leaf service, and if they're not already logged in, it handles redirecting them to the authentication service. And if they're, you know, if they're not logged in there, then they're prompted to log in, and then they get redirected back to where they wanted to be. And if they are already logged in to the authentication service, it's just a real quick OAuth dance to stand up the session in the leaf service.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And if I have, like, standalone apps, like one of the right apps against, well, I guess actually you kind of answered the question I was about to ask. I was going to say, does it support being able to generate a token, and then I can use that to authenticate against the API? Like, if I'm running an API that's a headless kind of thing, it's not something people are logging into. I can generate the OAuth secret and key from my central authority.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
You could. That wasn't really the focus of my talk. I was more talking about three-legged OAuth, where you are, you know, delegating to a provider, and it's all handled via browser redirects. But you can use two-legged OAuth to generate tokens and do, you know, direct access to services that way.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Okay, so you can get some pretty advanced functionality out of it. You can. You can do a lot of cool stuff with it. And the great thing is that it's an open standard.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
You know, a lot of really smart people have worked on it. A lot of people understand it. And so, for me, that's a much better solution than trying to invent my own thing and home roll some kind of, you know, distributed authentication thing. It's kind of like Yehuda talked about in his keynote the other day that, you know, building on top of shared solutions that other people can understand.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And so that makes it easier to let other people in on what's happening. Right. Stuff that I like to invent. It becomes a shorthand.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
You can say, oh, it's an OAuth strategy. Yep. Okay. I don't necessarily know all the internals about OAuth, but it puts me in a box.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
It does. It's a... I can say, okay, that, I can just put that off the side. Yep.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And just be like, okay, that is something I can follow for later. And that takes that cognitive load that Yehuda talked about. Yep. Absolutely.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
It's just an abstraction that you don't have to understand necessarily how it works. Just need to understand what it does. Yeah. Because when you first started to talk about, oh, I implemented this authentication strategy, my head is already thinking about, like, what is it?
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
You know, how does he do it? Is it, you know, like, HTTP auth or is it like this or like that? And then you're like, oh, OAuth. Okay.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Yeah. You know, go read the white paper, you know, or go read the docs. Okay. That's fine.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
But I can forget about it for the context of that application. I don't have to spend a lot of time thinking about it. Yep. And for, you know, speaking with web developers, it's nice because almost everybody at some point has encountered OAuth, even if they don't know that they've encountered it.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
You know, any time that you've ever done sign in with GitHub or sign in with Twitter or sign in with Facebook, that's all happening over OAuth. And so people have, you know, already have some experience with what that looks like to the user and how, you know, conceptually how it works where on this little service, you don't actually have to have a username and password. You just have to have one on the provider and then there's, you know, methods of communicating that information back and forth. So it's nice that it's something that people are somewhat familiar with.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
And then I was just kind of delving into the details of, you know, a little bit about how does the dance actually work and what's happening behind the scenes and then what gems can use to avoid having to implement all of that stuff. Right. Well, again, thank you very much for taking the time to speak with me. I appreciate it.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Thanks for having me, Mike. I enjoyed it. Sure. User groups with lots to say, interviews and more.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
No way! Sharing great ideas in the tech community. Fascinating conversations. A plethora of information.
Unattributed voices UGtastic archive transcript with speaker attribution pending ▶ Speaking
Find out for yourself today at euketastic.com. Find out for yourself today at euketastic.com.