Products

Solutions

Learn More

Partners

Community

Blog

About

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing DNN Authentication from external applicationUsing DNN Authentication from external application
Previous
 
Next
New Post
9/22/2016 10:11 AM
 
We would like to use DNNs authentication from an external WebAPI so that we can use Basic Validation in the WebAPI and then validate username and password against users and roles defined in the DNN portal?

Yes, I know that DNN has it's own WebAPI (Service Framework) but it sometimes causes problems compared to standard WebAPI, like if you want to use something like Swagger etc.

What would be the best way to achieve this in DNN8?

We tried to just put the connectionstring in our web.config and the reference the DotNetNuke DLLs in our WebAPI but when we try something like this:

AspNetMembershipProvider theMembershipProvider = new AspNetMembershipProvider();
UserInfo theUserInfo = theMembershipProvider.GetUserByUserName(Null.NullInteger, "lendo");


It will fail when the GetUserByUserName tries to run the cached stuff because of this:

public override UserInfo GetUserByUserName(int portalId, string username)
{
var objUserInfo = CBO.GetCachedObject(
new CacheItemArgs(string.Format(DataCache.UserCacheKey, portalId, username),
DataCache.UserCacheTimeOut, DataCache.UserCachePriority),
_ =>
{
using (var dr = _dataProvider.GetUserByUsername(portalId, username))
{
return FillUserInfo(portalId, dr, true);
}
});
return objUserInfo;
}
 
New Post
9/23/2016 11:00 AM
 
I'm guessing that we could use some kind of standard ASP.NET stuff for these as DNN, as far as I know, today use standard ASP.NET handling for users. Correct?
 
New Post
9/26/2016 12:06 PM
 
I guess it all comes down to calling the ValidateUser() function in DNN. However, that seem to assume that it is running in a DNN context and crashes on GetEffectivePortalId() even if you send in a correct Portal Id. Surely there must be a simple way to verify a username and password against the default DNN Authentication from an external application??
 
New Post
9/26/2016 2:12 PM
 
Hi Patrik,

I guess you need to create a special Authorization Layer that allows access to the DNN user store, by the protocols like OpenID Connect and OAuth2. This will federate DNN identity for: other web sites, mobile apps and native applications.
One of the approach is to create an Identity Server inside the DNN, something like this: https://identityserver.github.io/Docu...
 
New Post
9/26/2016 3:35 PM
 
Barry Waluszko wrote:
Hi Patrik,

I guess you need to create a special Authorization Layer that allows access to the DNN user store, by the protocols like OpenID Connect and OAuth2. This will federate DNN identity for: other web sites, mobile apps and native applications.
One of the approach is to create an Identity Server inside the DNN, something like this: https://identityserver.github.io/Docu...



Thank you for the suggestion Barry. In this case, I beleive that is perhaps a bit beyond the scope we are trying to solve. That said, one idea I've considered ia inplementing a DNN WebAPI exposing a method to do this. That would then run within the DNN context and should work. That said, I'm really surprised if that would really be needed for something as basic as this in a mature platform as DNN?
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing DNN Authentication from external applicationUsing DNN Authentication from external application


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
DNN Launch Webinar
VIEW ON-DEMAND
DNN Launch Webinar
VIEW ON-DEMAND
DNN Launch Webinar
VIEW ON-DEMAND