What is the default authorization used in ASP.NET Core and Angular? We are using default authentication.
Jwt
We need to change current session value
if (string.IsNullOrEmpty(user.EnvironmentId) == false)
{
claim.Identities.First().AddClaim(new Claim("Envid", ""));
}
i tried to
ASAPSessions.Envid="new session"
I would like to add new session value after i login into application. I have got the following error.
System.NullReferenceException: Object reference not set to an instance of an object.
at ASAP.ASAPEnvHub.ASAPEnvHubAppService.sessionenvidAsync(String value) in D:\PROJECT\ASAP_11022019\src\ASAP.Application\ASAPEnvHub\ASAPEnvHubAppService.cs:line 286
at lambda_method(Closure , Object )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
The code what i have tried to add the value in session.
public async Task<GetASAPEnvHubForEditOutput> sessionenvidAsync(string value)
{
string val = ASAPSessions.Envid;
var user = await _userManager.FindByIdAsync(AbpSession.UserId.ToString());
var claim = await _principalFactory.CreateAsync(user);
if (string.IsNullOrEmpty(user.OrganizationId) == false)
{
claim.Identities.First().AddClaim(new Claim("Envid", value));
SingleTon.Instance.AddValues("Envid", value);
}
var envHub = await _envHubRepository.FirstOrDefaultAsync(s => s.ENV_ID == value);
return ObjectMapper.Map<GetASAPEnvHubForEditOutput>(envHub);
}
Could you please assit me to solve this.
Hi @ismcagdas,
We have the CPQ application and ASP.NET Zero application. We have to login from CPQ to ASP.NET zero application without password authentication.
Notes: In our CPQ application we have the option to login into CPQ with password authentication. They are maintaining some keys in their portal, we can use that to encrypt the username from our application. After we encrpt we could pass the username, domain and encrypted value in url. It will not ask any authentication to login. It will login into CPQ application without password authentication.
Same way it could possible to login into ASP.NET zero application without password authentication.
Hi @ismcagdas Thanks for your response.
My both applications are not in ASPNET ZERO apps. my another one is a CPQ application. I require to login and view my ASPNET ZERO app automatically.
By default configuration is available in appSettings.json.
"IdentityServer": { "IsEnabled": "false", "Authority": "http://localhost:22742/", "ApiName": "default-api", "ApiSecret": "secret", "Clients": [ { "ClientId": "client", "AllowedGrantTypes": [ "password" ], "ClientSecrets": [ { "Value": "def2edf7-5d42-4edc-a84a-30136c340e13" } ], "AllowedScopes": [ "default-api" ] }, { "ClientId": "demo", "ClientName": "MVC Client Demo", "AllowedGrantTypes": [ "hybrid", "client_credentials" ], "RequireConsent": "true", "ClientSecrets": [ { "Value": "def2edf7-5d42-4edc-a84a-30136c340e13" } ], "RedirectUris": [ "http://openidclientdemo.com:8001/signin-oidc" ], "PostLogoutRedirectUris": [ "http://openidclientdemo.com:8001/signout-callback-oidc" ], "AllowedScopes": [ "openid", "profile", "default-api" ], "AllowOfflineAccess": "true" } ] },
could you share the working sample
As my application need to login from another application automatically.
would you send me format
suppose, I select 03-21-2019 it saved as 03-20-2019.
This is the code I am using to save in Typescript.
input.creatioN_TIME = moment(this.CreateDate);
input.expirY_DATE = moment(this.ExpiryDate);
this._organizationService.createOrUpdateASAPOrganizationsHub(input)
.pipe(finalize(() => this.saving = false))
.subscribe(() => {
this.notify.info(this.l('SavedSuccessfully'));
this.OrganizationSave.emit(this.organization);
this._router.navigate(['app/admin/ASAPOrganizationHub']);
});