Keycloak retrieve custom attributes to KeycloakPrincipal

To add custom attributes you need to do three things: Add attributes to admin console Add claim mapping Access claims The first one is explained pretty good here: https://www.keycloak.org/docs/latest/server_admin/index.html#user-attributes Add claim mapping: Open the admin console of your realm. Go to Clients and open your client This only works for Settings > Access Type confidential … Read more

How should I check if a user is authenticated in MVC5?

There’s no difference. The only difference is that if the user is not authenticated User.Identity might be null and thus you might get a NRE, whereas with the second approach, internally there’s a check for this and is safer. Here’s how the Request.IsAuthenticated method is implemented: public bool IsAuthenticated { get { return this._context.User != … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)