protected void createAndSendLoginRequest(DossiaOpenID dossiaOpenID, OpenIdClient openIdClient, Boolean reqAttributes, Boolean reqOauthToken) { dossiaOpenID.InitializeForSending(openIdClient); // see http://docs.dossia.org/index.php/Dossia_OpenID_Consumer_Developer_Guide#Attributes_Available_via_OpenID // for list of available attributes if (reqAttributes) { AttributeExchange attributeExchange = new AttributeExchange(openIdClient); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/address1", "address1", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/address2", "address2", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/city", "city", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/dateOfBirth", "dateOfBirth", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/email", "email", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/employeeId", "employeeId", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/employer", "employer", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/firstName", "firstName", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/gender", "gender", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/lastName", "lastName", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/middleName", "middleName", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/postalCode", "postalCode", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/state", "state", 1, true); } if (reqOauthToken) { OAuthClient oauthClient = DossiaOauth.createDossiaOAuthClient(); OAuthExtension oauthext = new OAuthExtension(openIdClient, oauthClient); } openIdClient.CreateRequest(false, true); }
protected void createAndSendLoginRequest(DossiaOpenID dossiaOpenID, OpenIdClient openIdClient) { dossiaOpenID.InitializeForSending(openIdClient); AttributeExchange attributeExchange = new AttributeExchange(openIdClient); // see http://docs.dossia.org/index.php/Dossia_OpenID_Consumer_Developer_Guide#Attributes_Available_via_OpenID // for list of available attributes attributeExchange.AddFetchItem("http://openid.dossia.org/participant/firstName", "firstName", 1, true); attributeExchange.AddFetchItem("http://openid.dossia.org/participant/lastName", "lastName", 1, true); openIdClient.CreateRequest(false, true); }
public IUser GetOrCreateUserIfCorrectFormOfIdentity(string identity) { if (identity.StartsWith("http://") || identity.StartsWith("https://")) { NameValueCollection openIdClientArgs = new NameValueCollection(); OpenIdClient openIdClient = new OpenIdClient(openIdClientArgs); openIdClient.Identity = identity; openIdClient.TrustRoot = null; openIdClient.ReturnUrl = new Uri(string.Format("http://{0}", FileHandlerFactoryLocator.HostnameAndPort)); // The proper identity is encoded in the URL Uri requestUri = openIdClient.CreateRequest(false, false); if (openIdClient.ErrorState == ErrorCondition.NoErrors) if (openIdClient.IsValidIdentity()) { RequestParameters openIdRequestParameters = new RequestParameters(requestUri.Query.Substring(1)); identity = openIdRequestParameters["openid.identity"]; return GetOrCreateUser(identity); } } return null; }
protected void createAndSendLoginRequest(DossiaOpenID dossiaOpenID, OpenIdClient openIdClient) { dossiaOpenID.InitializeForSending(openIdClient); openIdClient.CreateRequest(false, true); }