public async Task <ResourceOwner> Execute(LocalAuthenticateParameter parameter, string imagePath, string hostUrl) { if (parameter == null) { throw new ArgumentNullException(nameof(parameter)); } if (string.IsNullOrWhiteSpace(parameter.Xml)) { throw new ArgumentNullException(nameof(parameter.Xml)); } var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(parameter.Xml); CheckXmlWellFormed(xmlDocument); var resourceOwner = ExtractResourceOwner(xmlDocument, imagePath, hostUrl); var existingResourceowner = await _resourceOwnerRepository.GetAsync(resourceOwner.Id); if (existingResourceowner == null) { await _resourceOwnerRepository.InsertAsync(resourceOwner); } return(resourceOwner); }
public async Task <LocalOpenIdAuthenticationResult> Execute(LocalAuthenticateParameter localAuthenticateParameter, AuthorizationParameter authorizationParameter, string code, string imagePath, string hostUrl) { if (localAuthenticateParameter == null) { throw new ArgumentNullException(nameof(localAuthenticateParameter)); } if (authorizationParameter == null) { throw new ArgumentNullException(nameof(authorizationParameter)); } var resourceOwner = await _localAuthenticateAction.Execute(localAuthenticateParameter, imagePath, hostUrl); if (resourceOwner == null) { throw new IdentityServerAuthenticationException("the resource owner credentials are not correct"); } var claims = resourceOwner.Claims == null ? new List <Claim>() : resourceOwner.Claims.ToList(); claims.Add(new Claim(ClaimTypes.AuthenticationInstant, DateTimeOffset.UtcNow.ConvertToUnixTimestamp().ToString(CultureInfo.InvariantCulture), ClaimValueTypes.Integer)); return(new LocalOpenIdAuthenticationResult { ActionResult = await _authenticateHelper.ProcessRedirection(authorizationParameter, code, resourceOwner.Id, claims), Claims = claims }); }
public Task <LocalOpenIdAuthenticationResult> OpenIdLocalAuthenticate(LocalAuthenticateParameter localAuthenticateParameter, AuthorizationParameter authorizationParameter, string code, string imagePath, string hostUrl) { return(_openIdLocalAuthenticateAction.Execute(localAuthenticateParameter, authorizationParameter, code, imagePath, hostUrl)); }
public Task <ResourceOwner> LocalAuthenticate(LocalAuthenticateParameter parameter, string imagePath, string hostUrl) { return(_localAuthenticateAction.Execute(parameter, imagePath, hostUrl)); }