Base solution for your next web application

Activities of "jhoiby"

I got it working.

I ended up downloading a new template this evening and it worked first try.

Sorry I'm such a pain but thank you for this huge framework you've put together. Eventually I'll get it working with Azure AD OpenIDConnect!

James

Answer

I'm getting an almost identical issue with a virgin ASP.Net/Angular template I downloaded 15 minutes ago and built in Visual Studio 2017.

ERROR 2017-05-02 19:21:16,001 [15   ] nHandling.AbpApiExceptionFilterAttribute - Method not found: 'System.String Abp.Runtime.Security.SimpleStringCipher.Decrypt(System.String, System.String, Byte[])'.
System.MissingMethodException: Method not found: 'System.String Abp.Runtime.Security.SimpleStringCipher.Decrypt(System.String, System.String, Byte[])'.
   at Abp.MultiTenancy.TenantCache`2.CreateTenantCacheItem(TTenant tenant)
   at Castle.Proxies.TenantCache`2Proxy.CreateTenantCacheItem_callback(Tenant tenant)
   at Castle.Proxies.Invocations.TenantCache`2_CreateTenantCacheItem.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation)

I did a straight stock download/unzip to project folder/create and update database/run. I'm assuming it's not a package version mismatch because this is a fresh full download with no modifications.

I was able to login as admin but when I create a new tenant called "MyTenant" I get the method not found error listed in the original post.

I downloaded this new template version since I was able to not get logging to work in the Core template. I'm getting frustrated. :?

Thanks,

James

Additional info: I have been going through the Log4Net and ABP docs to see if I'm missing anything and I did put in some debug code of my own in the debug controller to make sure messages are being generated (breakpoints show the debugging methods are getting hit). Still I'm not seeing any debug logs.txt files. I'm wondering if there are any common issue others have found?

The only thing in the bin folder is the debug folder. I've checked for hidden files and I've confirmed that it's not there.

I also gave "everyone" read/write access to the full *.Web.Host tree and still no log.

What does it take for a log file to be generated? All I'm doing to test it is starting the site in Visual Studio 2017 and logging on/off with the admin/123qwe account. Is this enough to generate a logging event?

Is there a way to increase log verbosity?

Here's my (unmodified default) log4net configuration.

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
    <file value="Logs/Logs.txt" />
    <encoding value="utf-8" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10000KB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" />
    </layout>
  </appender>
  <root>
    <appender-ref ref="RollingFileAppender" />
    <level value="DEBUG" />
  </root>
</log4net>

Thank you!

James

I'm using 3.0.1 which should be compatible, but I'll try 3.1.x in the next couple of days.

Thank you,

James

Hello, after having given up on this after many hours I'm trying to tackle it again. I'm getting better at OWIN debugging but I still need your help.

When I start the solution with a clear browser cache I am sent straight to the Azure login page. After I submit the Azure credentials, the browser just keeps making looping calls over-and-over to the ABP website without displaying any page. When I trace the execution it is just re-executing the OWIN pipeline repeatedly.

After the Azure login screen and the second pass through the OWIN pipeline, the OpenIDConnect middleware is properly setting the Identity.IsAuthenticated = true and I can see the claim info in the OWIN context, but then the pipeline just executes again and when it gets to the UseExteralSignInCookie middleware the IsAuthenticated property gets set back to false and the claims are nulled out.

Another thing I'm noticing is that none of my breakpoints in the Account controller are ever getting hit. The Login page or ExternalLogin controller methods are never firing.

I am using the MVC5/Angular template.

Here is the current code I'm using for startup.cs:

public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseAbp();
            app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.UseOpenIdConnectAuthentication(CreateOpenIdOptions());
            app.MapSignalR();
        }

        private static OpenIdConnectAuthenticationOptions CreateOpenIdOptions()
        {
            var options = new OpenIdConnectAuthenticationOptions
            {
                Authority = ConfigurationManager.AppSettings["ExternalAuth.OpenId.Authority"],
                ClientId = ConfigurationManager.AppSettings["ExternalAuth.OpenId.ClientId"],
                //PostLogoutRedirectUri = WebUrlService.WebSiteRootAddress + "Account/Logout",
                PostLogoutRedirectUri = ConfigurationManager.AppSettings["ExternalAuth.OpenId.LogoutUri"],
                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    SecurityTokenValidated = notification =>
                    {
                        var email = notification.AuthenticationTicket.Identity.Name;
                        notification.AuthenticationTicket.Identity.AddClaim(new Claim(ClaimTypes.Email, email));
                        return Task.FromResult(0);
                    }
                }
            };

            var clientSecret = ConfigurationManager.AppSettings["ExternalAuth.OpenId.ClientSecret"];
            if (!clientSecret.IsNullOrEmpty())
            {
                options.ClientSecret = clientSecret;
            }

            return options;
        }

    }

My web.config configuration settings:

<add key="ExternalAuth.OpenId.Authority" value="https://login.microsoft.com/(mydomain).onmicrosoft.com/" />
<add key="ExternalAuth.OpenId.ClientId" value="5cd0a368-(redacted)-f0a3eee24eae" />
<add key="ExternalAuth.OpenId.LogoutUri" value="https://localhost:44305/Account/Logout" />

My Azure AD configuration settings:

Display Name: ACMETest
Home Page: https://localhost:44305/
Application ID: 5cd0a368-(redacted)-f0a3eee24eae
Multi-tenanted: No (Note: ABP multi-tenancy is default ON)
Reply URL: https://localhost:44305/Account/ExternalLoginCallback/ (I've tried several, see below)
API Access Permissions/Keys: Default (None added or changed after initial app registration)

MY QUESTIONS:

  1. What Reply URL should I be using in Azure AD? I've tried:
https://localhost:44305/Account/Login/
https://localhost:44305/Account/ExternalLogin/
https://localhost:44305/Account/ExternalLoginCallback/
https://localhost:44305/
  1. Does my pipeline setup look right to you?

  2. Do you have any other ideas?

I keep seeing references in this forum to the "few lines of code needed" to get Azure OIDC working but I am never able to get it to work. If you help me get this going I would be happy to write a clear, concise step-by-step guide for posting here or in the ABP documentation!

Thank you!

James

P.S. I just noticed that you have made an ASP.NET Core 1.x Angular2 template available! I've been using the MVC 5 template because it was the only one that supported Angular, but now that the new Core template is available I will try that as well.

Thank you for the quick response!

That looks like ASP.Net Core code, and I'm using the MVC 5.x template. However, in the interest of getting it working ANY way possible I've installed the Core template on my system and am testing with the code you supplied. If it works that will at least let me know my configuration is correct and I can proceed from there.

The first issue I'm running into is building the code provided. I'm not able to identify what namespace the "ExternalAuthenticationScheme" object belongs to in your line:

SignInScheme = ExternalAuthenticationScheme

Neither VisualStudio or Google are helping me find what reference I need to add for that.

Also, may I assume you left the rest of the code in AuthConfigurer.cs unchanged?

Thank you!

Showing 1 to 7 of 7 entries