How to send more attributes in SAML response along with email Id - adfs2.0

I am doing login to ADFS using fedlet created using openam. In fedlet i am getting saml response from ADFS in which I get only email address but I want other attributes like role,user name,user status,password .How I do get this attributes in my fedlet application.
Thanks.

I assume you took the sp.xml fedlet file and imported it into ADFS as a RP trust?
All you need to do is add some claims rules to the RP using the "Send LDAP Attributes as Claims" and then select the AD attributes you want to include in the SAML response.

Related

Azure API Management OAuth 2.0 Resource Owner Password Flow Client ID

Context:
My software application is a multi-tenant application that customers can log into and generate their own clientIDs to use with a resource owner password flow OAuth Request.
Our OAuth 2.0 authorization server is built in WebAPI and inherits from the Microsoft provided Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerProvider class.
Currently, we only support one flow (resource owner password) to get a token, which looks like:
POST /api/v1.0/token HTTP/1.1
Host: api.mysoftwareapp.com
UserName={username}&Password={password}&grant_type=password&client_id={client_id}
After we validate the credentials & client ID, we send back an access token generated by the Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerProvider base class. In order to access a resource, a user would need to supply the access_token in the Authorization header as a Bearer token. Client ID is not required to be passed in again. Example below:
GET /api/v1.0/Partners HTTP/1.1
Host: api.mysoftwareapp.com
Authorization: Bearer this_is_where_the_token_goes
I'd like to implement the developer portal feature of Azure API management and allow for my customers to be able to input their own username, password, and client ID when making test calls, so they get data back in the context of their tenant (and ultimately - enable rate limiting by client ID).
In the publisher portal, under Security->OAuth 2.0, I've:
Only checked the Resource owner password grant type.
Specified my authorization request method as POST.
Added my token endpoint URL.
Added grant_type / password as an additional body parameter.
Left the resource owner password credentials blank.
I've also done the following since they were required, but I believe does not apply due to only supporting resource owner password flow, and handling client registrations through my own application:
Added my authorization endpoint URL.
Selected 'In the Body' as my client authentication method.
Added fake client credentials.
Added a fake client registration page URL.
Here's a screenshot of that:
When I navigate to the developer portal and view an endpoint, I can select 'Resource onwer password' under my Auth server. However, when I select this, a popup shows that only lets me input my username and password, NOT my client ID.
How do I set up Azure API Management to allow a user to also specify the client ID they would like to use when setting up authorization - or would we need to change our API to require the client ID when making calls to specific resources instead of when requesting a token?
This is what I'd need:
In order to pass these values in the POST body, you need to change the client authentication method from "basic" to "post".
Go to Publisher Portal security, and modify the OAuth2 server settings to be like the below:

possible to log in to an ADFS environment with only a UPN

We have an application that checks against active directory for valid UN/PW combinations with a simple LDAP query. That query simply responds with a message of yes or now to validate the user. Unfortunatley we have no control over this application so can't make it a claims aware applicaiton which would provide AD access to the user.
Is there a way with SAML or something to log a user in to AD / ADFS with only their email address (UPN) so that we can then provide them access to other services on our domain?
Ultimately, we are going to use the token to SSO the users to an Office365 implementation that we have.
ADFS will authenticate against AD via several methods, one of them being username/password. You don't need your homegrown application.

How does SE's single signon work?

Basically I just want to know how does StackExchange's single signon system work?
In the SE network you need to login only once in one of the websites to be automatically logged in to the other sites upon visiting.
How should I implement such a feature in my own network of sites?
I assume it uses the cookie which resides on the user's browser and then authenticates it with the originating site. If it is legit then it logs the user in automatically.
You have to implement SAML or oauth2 to allow sso on your network.
In case of SAML your child websites will be service providers or resource servers.
While you need to setup and identity provider.
The sequence of events will be like this.
1. User hits a url of songs website, this site is resource server and does not handle authentication.
2.To authenticate resource server will construct a SAML authrequest and redirects to identity provider after signing it.
Idp verifies the signature after receiving authrequest.
3. User will be presented with a login form, user has to end login credentials.
4. After user authentication idp will generate a SAMl token and redirect back to resource server.
5. Resource server will extract identity information from SAML token, resource server will login the user with session or cookie.
Depends upon which technology you are working in i have implemented it in php using simplesamlphp.

ADFS 2.0 claims transformation

I have Sharepoint which has configured claims based authentication with the adfs. ADFS is configured to use third party claims provider trust. So when user is accessing sharepoint he is redirected through the adfs to the third party identity provider login page. This identity provider (IdP) returns saml2 token back to the adfs and adfs redirect user to the sharepoint.
the problem is that third party IdP is configured to return only specific saml attributes (claims). I need to configure ADFS to understand this specific attribute.
the custom saml attributes looks like:
<saml:Attribute Name="CustomID">
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">12345</saml:AttributeValue>
</saml:Attribute>
How can I use this claims in ADFS and then send it to the sharepoint?
thanks.
Set up the ADFS / RP config. for the RP to pass through all claims instead of getting them from AD.

Get email address from SAML Response using Single Sign On and ADFS

I am in the process of setting up a single sign on (SSO) system using ADFS and SAML 2.0. I have to following scenario that I am stuck on:
1) User attempts to access web resource, is not logged in so is directed to ADFS SSO service.
2) User successfully authenticates against ADFS.
3) ADFS passes SAML Response back to web resource.
4) The web resource itself has a user database but the user does not exist here.
5) So, the web resource must create the user account silently. To do this I need the email address.
So, is it possible to configure ADFS to return the email address of the user in a successful SAML response message?
You can configure ADFS to return an Email claim, provided ADFS has some way of getting this (Active Directory or some other attribute store, maybe a database it can access?) and provided your application is set up to decrypt the returned token to read the claims inside.
Assuming this is ADFS 2.0:
Set up your web resource as a Relying Party Trust (sounds like you've done this)
Right-click the RP and choose Edit Claim Rules...
On the Issuance Transform Rules tab, add a new rule for Email address
If you can get the email from Active Directory because your users are authenticating through a domain, then you can choose the "Send LDAP Attributes as Claims" rule template.
Otherwise, you'll have to pick "Send Claims Using a Custom Rule" and set up a custom attribute store (to the database or whatever it is) and go through the motions of writing a claim rule to do it.
Once you have that set up, in your ASP.NET app you'll need to configure it to use ADFS as your token issuer. This is accomplished with the Windows Identity Framework Microsoft.IdentityModel.dll and associated configuration. If you've installed the WIF SDK, you should have some extra options in Visual Studio, namely if you right-click your web project there should be an "Add STS Reference" option. This will run FedUtil which is a wizard that will automatically set up your web.config appropriately. Google around for how to set things up.
Now that your site is using ADFS for claims, you'll need to make a few changes. Under the <microsoft.identityModel> section in your web.config, ensure that you have set it to save the bootstrap token (<service saveBootstrapTokens="true">). In your code, you can now access the email claim whenever you need it by doing:
string email = (User.Identity as IClaimsIdentity).Claims.Where(c => c.ClaimType == ClaimTypes.Email).FirstOrDefault().Value;
If you don't set it to save the bootstrap token, then the Claims collection there will be empty.
There's potentially a lot of other factors that can mess things up along the way, though. Hopefully this will get you on the right track.