identityserver3 - AuthenticateResult: Why are some claims missing? -
i'm trying out self-hosted identityserver3 solution , have come across issue haven't found answer to.
this identityserver setup:
var factory = new identityserverservicefactory(); factory.useinmemoryclients(config.getclients()) .useinmemoryscopes(config.getscopes()); factory.userservice = new registration<iuserservice>(resolver => new localregistrationuserservice()); var options = new identityserveroptions { sitename = "demo idp", signingcertificate = certificate.get(), factory = factory, requiressl = convert.toboolean(configurationmanager.appsettings["requiressl"]), }; app.useidentityserver(options);
scope(s) , client(s):
public static ienumerable<client> getclients() { return new list<client> { new client { clientid = "resourceowner.client", clientsecrets = { new secret("3fe8fb45-627a-4c44-bbe3-63281c6ca910".sha256()) }, allowedscopes = { "demo", "openid", "profile" }, flow = flows.resourceowner, } }; } public static ienumerable<scope> getscopes() { return new list<scope> { new scope { name = "demo", displayname = "demo", }, standardscopes.openid, standardscopes.profile, }; }
and in localregistrationuserservice.authenticatelocalasync(localauthenticationcontext context)
i've got:
var loginresult = new accountmanagementservice().login(context.username, context.password); if (loginresult.loginok) { context.authenticateresult = new authenticateresult(loginresult.subject, loginresult.username); } else { .... }
my understanding of following paragraph documentation
*to log user in authentication api must produce subject , name represent user. subject user service’s unique identifier user , name display name user displayed in user interface.*
is subject , username present in token returned identityserver. however, when decode token get:
access token (decoded): { "typ": "jwt", "alg": "rs256", "x5t": "a3rmugmfv9tpclla6yf3zakfque", "kid": "a3rmugmfv9tpclla6yf3zakfque" } { "iss": "http://localhost:44333/core", "aud": "http://localhost:44333/core/resources", "exp": 1478524845, "nbf": 1478521245, "client_id": "resourceowner.client", "scope": [ "demo", "openid", "profile" ], "sub": "6ace8b2e-ce20-41e9-8d4e-382168e4ce05", "auth_time": 1478521245, "idp": "idsrv", "amr": [ "password" ] }
as evident, no name claim present. i've tried adding claim explicitly when instantiating authenticateresult, no avail. i'm missing here, can't best of figure out i'm doing wrong tips, pointers and/or helpful example appreciated.
tia
Comments
Post a Comment