Glimpse / Glimpse.Prototype

Glimpse v2 prototype
MIT License
185 stars 44 forks source link

User identification #25

Closed nikmd23 closed 9 years ago

nikmd23 commented 9 years ago

Provide a mechanism for users to enhance the Glimpse experience by annotating user sessions with some sort of meaningful identifier. (Name? Username? Email?)

@leastprivilege has a nice write up about security in ASP.NET 5. His article leads me to believe that we might be able to leverage claims.

If this system worked automatically with other popular authentication frameworks, than that's even better.

We might want to consult with @leastprivilege & @brockallen about this, cause I'd love to make sure "it just works" with @IdentityServer

brockallen commented 9 years ago

IdentityServer uses the sub claim (as defined in the OpenID Connect specification) to uniquely identity the user.

nikmd23 commented 9 years ago

Are picture and/or email set then as well? Or at least easy for the developer to have set?

nikmd23 commented 9 years ago

High Level

User identification will publish a message like this:

{
  id: "(standard message Id)",
  type: "user-identification",
  payload: {
    userId: "(a user id)",
    username: "(a display name for the user)",
    email: "(the email address for the user)",
    image: "(fully qualified path to user image)"
  },
  context: { id: "(standard request Id)", type: "request" },
  indices: { request-userId: "(same as payload.userId)"  }
}

Detailed Breakdown

Example

Authenticated

For a logged in user, the published payload could be as simple as this:

{
  userId: "nikmd23",
  username: "Nik",
  email: "nik@example.com",
  image: "http://www.gravatar.com/avatar/e07a27ec61977c7c686feaa799b1cf6e.jpg"
}

Which might output something like:

Nik

Guest

For a user who is not logged in, this is what might be published:

{
  userId: "5b863580-202b-4c6a-8fec-dd8cfe07db22",
  username: "E746",
  image: "http://www.gravatar.com/avatar/5435e45ccc985662024892ee58472c31.jpg?d=identicon"
}

Which might output something like:

E746

Still To Be Implemented

For this to work, the following (and more) may needs to be implemented:

brockallen commented 9 years ago

One additional comment I should make: if there is no sub claim, then you might want to look for the NameIdentifier claim (https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.claims.claimtypes.nameidentifier.aspx). This might be present in lieu of sub for some types of applications.

nikmd23 commented 9 years ago

Thanks for the info @brockallen!