{"action":"created","issue":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/2049","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/2049/labels{/name}","comments_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/2049/comments","events_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/2049/events","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/2049","id":112615289,"number":2049,"title":"How can I filter on a custom claim field when getting a token?","user":{"login":"chrismikec","id":8548791,"avatar_url":"https://avatars.githubusercontent.com/u/8548791?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismikec","html_url":"https://github.com/chrismikec","followers_url":"https://api.github.com/users/chrismikec/followers","following_url":"https://api.github.com/users/chrismikec/following{/other_user}","gists_url":"https://api.github.com/users/chrismikec/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismikec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismikec/subscriptions","organizations_url":"https://api.github.com/users/chrismikec/orgs","repos_url":"https://api.github.com/users/chrismikec/repos","events_url":"https://api.github.com/users/chrismikec/events{/privacy}","received_events_url":"https://api.github.com/users/chrismikec/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-21T15:28:20Z","updated_at":"2015-10-21T15:43:57Z","closed_at":null,"body":"I am using IdentityServer successfully with a ResourceOwner flow. So I am successfully getting the user claims in a token.\r\n\r\nHowever, I need to add a new column to the AspNetUserClaim table, indicating a company ID, as users can access the application as different companies from the same account (but only AS one company at a time). The user can have different claims for different companies, so I need to be able to pass in a companyId when I request the token, then have IdentityServer filter on companyId in the UserClaims to get only those claims with companyId=X.\r\n\r\nI'm using a CustomIdentityManager with a CustomUserStore, and there is a CustomUserClaim object used by the custom context, but right now all of these are just the defaults (that is, no custom code inside them). I would imagine I could do something like  add the companyId field to the CustomUserClaim, but from there I've got no idea how I would (1) pass the companyId in when I request the token, and (2) filter based on that id.\r\n\r\nI currently call  OAuth2Client.RequestResourceOwnerPasswordAsync to request the token.\r\n\r\nIs this at all possible? Is there a better way to handle this?"},"comment":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/comments/149938280","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/2049#issuecomment-149938280","issue_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/2049","id":149938280,"user":{"login":"chrismikec","id":8548791,"avatar_url":"https://avatars.githubusercontent.com/u/8548791?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismikec","html_url":"https://github.com/chrismikec","followers_url":"https://api.github.com/users/chrismikec/followers","following_url":"https://api.github.com/users/chrismikec/following{/other_user}","gists_url":"https://api.github.com/users/chrismikec/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismikec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismikec/subscriptions","organizations_url":"https://api.github.com/users/chrismikec/orgs","repos_url":"https://api.github.com/users/chrismikec/repos","events_url":"https://api.github.com/users/chrismikec/events{/privacy}","received_events_url":"https://api.github.com/users/chrismikec/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T15:43:57Z","updated_at":"2015-10-21T15:43:57Z","body":"They have a default companyId on their account, so at first they are validated against this company. After they have logged in, they get prompted to find out which company they want to identify as. Once they select it, they have access to the application as that company. So, if they select a different company than their default, I want to request a new token as that company.\r\n\r\nDoes this make sense?"}}