Not able to Access DNN service on public IP - dotnetnuke

I have created DNN service .
Its running on my localhost but i am not able to access on public IP.
I have done following steps:
Create Site on IIS and added path of my application
Added Port and open it on AWS public IP
Given all permission to my application folder.
I am getting this Error:
404 Not Found The requested Url does not return any valid content. Administrators Change this message by configuring a specific 404 Error Page or Url for this website.

Just I Added new entry in PortalAlias table and provide my Public ip with port as HTTPAlias.

Related

Unable to connect to GCP CloudSQL using Private IP address (CORS error preflight missing allow origin header)

I am using GCP Cloud SQL instances for getting data. This SQL instance when accessed with its public IP address, connection is happening and data is visible. But due to security constraint I will have to access it only via private IP address.
I made code changes as said in Google documentations for connection via private IP address:
(https://cloud.google.com/sql/docs/postgres/connect-app-engine-standard#private-ip_1)
(https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#java-8)
In ConnectionPoolContextListener.java file: iptypes=Private added
config.addDataSourceProperty("ipTypes", "PRIVATE");
In appengine-web.xml file: serverless vpc connector element added
projects/PROJECTNAME/locations/europe-west1/connectors/CONNECTORNAME
all-traffic
In gitlab-ci.yml file: line to deploy the connector service added
deploy_env-name:
script:-gcloud app deploy src/main/webapp/WEB-INF/appengine-web.xml
These changes are not working and the API calls made are failing giving CORS errors(cross origin resource sharing error preflight missing allow origin header)(refer to screenshot)
UI CORS Error
App engines logs are as follows:
com.zaxxer.hikari.pool.HikariPool throwPoolInitializationException: HikariPool-1 - Exception during pool initialization. (HikariPool.java:587)
org.postgresql.util.PSQLException: The connection attempt failed.
...
Caused by: java.io.IOException: Connection refused
Everything is working when public IP address is used no CORS error also. But with private IP address connection is failing, not sure what is wrong here.
DB Connection code:
private DataSource createConnectionPool() {
HikariConfig config = new HikariConfig();
config.setJdbcUrl(String.format("jdbc:postgresql://google/%s",
DB_NAME));
config.setUsername(DB_USER);
config.setPassword(DB_PASS);
config.addDataSourceProperty("socketFactory",
"com.google.cloud.sql.postgres.SocketFactory");
config.addDataSourceProperty("cloudSqlInstance",
CLOUD_SQL_CONNECTION_NAME);
config.addDataSourceProperty("ipTypes", "PRIVATE");
config.setMaximumPoolSize(10);
config.setMinimumIdle(5);
config.setConnectionTimeout(10000); // 10 seconds
config.setIdleTimeout(600000); // 10 minutes
config.setMaxLifetime(1800000); // 30 minutes
DataSource pool = new HikariDataSource(config);
return pool;
}
There was something wrong in VPC connector that I had created before. I created a new VPC connector with same network and region as those of the cloudsql instance and assigned an IP address range and now this DB connection is happening and data is getting loaded and CORS error has gone.
So to connect to a SQL instance via Private IP address from App engine I had to make only the following changes:
Create a Serverless VPC connector.
add vpc-connector element in appengine.yml file
include property "iptypes" in ConnectionPoolContextListener.java file
Here's the problem. The connection string has an error in it:
// Not correct
config.setJdbcUrl(String.format("jdbc:postgresql://google/%s", DB_NAME));
// Should be
config.setJdbcUrl(String.format("jdbc:postgresql:///%s", DB_NAME));
See the documentation for details: https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/main/docs/jdbc-postgres.md#creating-the-jdbc-url.

Using Saml with Azure AD using Blazer Web assembly

I'm trying to use .NET core Blazer webAssembly client UI from main() and authenticate with Azure AD using SAML with the following code, but getting error. can't figure this out one issue below. any clue is appreciated
there was an error trying to log you in: 'Cannot read property 'redirectUri' of undefined'
OIDC works fine.
Below is my code called from Main in Program.cs
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddHttpClient("BlazorWASMAuthApp.ServerAPI", client => client.BaseAddress = new Uri(builder.HostEnvironment.BaseAddress))
.AddHttpMessageHandler<BaseAddressAuthorizationMessageHandler>();
builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>()
.CreateClient("BlazorWASMAuthApp.ServerAPI"));
builder.Services.AddApiAuthorization(); builder.Services.AddAuthenticationCore(); builder.Services.AddAuthorizationCore();
builder.Services.AddAuthentication().AddSaml2(options =>
{
// builder.Configuration.Bind("AzureAd", options.SPOptions.AuthenticateRequestSigningBehavior);
//APP Registration keys Will be moved to Json in subsequent story
options.SPOptions.EntityId = new EntityId("https://localhost:5001/saml2");
//options.SPOptions..Add("https://localhost:5001/saml2/API.Access");
options.IdentityProviders.Add(
new IdentityProvider(
new EntityId("https://sts.windows.net/{Clientid}/"), options.SPOptions)
{
//SingleSignOnServiceUrl = signinURI,
MetadataLocation = ...federationdataxml?clientid={clientid}"
});
;
})
.AddCookie();
The most common errors as per ms docs are caused by incorrect configuration
Depending on the requirements of the scenario, a missing or incorrect
Authority, Instance, Tenant ID, Tenant domain, Client ID, or Redirect
URI prevents an app from authenticating clients.
Running the app at a different port than is configured in the Redirect
URI of the Identity Provider's app registration.
Please check if the cause is missing return url parameter in configuration in your code provided:
options.SPOptions.ReturnUrl = new Uri("https://localhost:5001/authentication/azurecallback"); which comes after
options.SPOptions.EntityId = new EntityId("https://localhost:5001/saml2");
else check Portal side configurations.
While registering API , redirect uri is set as web and its field is left empty and api is exposed from Expose api .
But When registering client app , redirect uri must be set ,hope you have done so.
client app > go active directory b2c >give name >select supported account>redirect uri >select SPA-give redirect ur like https://localhost:5001/authentication/login-callback
(format of uri : https://localhost:{PORT}/authentication/login-callback.)
This 'authentication/login-callback' must be present in your code configuration too.
From reference
NOTE: The default port for an app running on Kestrel is 5001. If the
app is run on a different Kestrel port, use the app's port. For IIS
Express, the randomly generated port for the app can be found in the
Server app's properties in the Debug panel. Since the app doesn't
exist at this point and the IIS Express port isn't known, return to
this step after the app is created and update the redirect URI. A
remark appears in the Create the app section to remind IIS Express
users to update the redirect URI.
So Check the port running and update the redirect uri if not done.
References:
Reference 1
Reference 2
Cors

UNAUTHORIZED_CLIENT ABP Framework

My client site is broadcasting from 10.0.0.70. api broadcasts from localhost:44376 on the same machine.
10.0.0.70:4200 opens but when I click login it leads to http://localhost:44376/account/login site but 500
Internal Server Error
I am getting an UNAUTHORIZED_CLIENT error.
Probably you changed the appsettings endpoints to 10.0.x from localhost after running dbmigrator causing your client still registered with localhost:4200 redirect uri.
That's why you're getting UNAUTHORIZED_CLIENT error. I assume you are at the beginning of the project; you can delete your db and run db migrator again with your updated settings.
You can also check application logs for exact error messages; identityserver errors are logged detailed in log file.
This usually happens when CORS URL defined in the ClientCorsOrign database table is not valid. eg https:///www.domain.co.za is valid while https:///www.domain.co.za/app is not valid. So to accurate identitify cause of this error, open Logs in Identity api, in my case the CORS url was invalid..

Google + Invalid redirect URI

I am using a slogin joomla extension.
creating a google plus developer account.
create a client id but error will be arise
**Error:**Invalid redirect URI.
AUTHORIZED JAVASCRIPT ORIGINS:
I am giving http://mylocal server ip address.
AUTHORIZED REDIRECT URIS:
In this field i am giving http://mylocal server ip address/folder/subfolder/?option=com_slogin&task=check&plugin=google
ip address:49.206.140.128
please give me a answer asap
the only issue with slogin is uri mismatch.i just got it worked.
from joomla admin of your website,copy the exact "callback URL" (select by double clicking on it ) from google plugin and add that in uri in ur google app.
after breaking my head on this issue for almost a day,this is the solution which i got...DONT COPY the uri from error message on your browser.

Running Facebook Connect on localhost

I can't run facebook connect on localhost.
I am using app-engine on pydev.
I configured the site in facebook to : http://localhost:8080
but it returns an error :
API Error Code: 100
API Error Description: Invalid parameter
Error Message: next is not owned by the application.
Is there a way to work with facebook on localhost?
Thanks,
Gavriel
Set both your Site URL and Post-Authorize Redirect URL to http://localhost:8080/
Also, if you're using Internet Explorer, see here:
Facebook Connect / Graph - problems in Internet Explorer with fb:login dialog (not closing)
I found that using http://127.0.0.1:8080 in the browser instead of http://localhost:8080/ fixed a problem I was having in IE.
For future reference, the issue arises because of IE security settings. I fixed it by setting the local intranet zone (i.e. localhost) enhanced security checkbox, same as internet zone.

Resources