GNUnet preparation
==================
Setup zone for RP:
gnunet-identity -C martin
Extracted from OpenID connect button 'redirect_uri':
http://127.0.0.1:9999/wp-admin/admin-ajax.php?action/openid-connect-authorize
gnunet-namestore -a -z martin -n @ -t RECLAIM_OIDC_REDIRECT -V http://127.0.0.1:9999/wp-admin/admin-ajax.php?action=openid-connect-authorize -e 1h -p
# Set name of Web site ("wootaler") to be shown to user:
gnunet-namestore -a -z martin -n @ -t RECLAIM_OIDC_CLIENT -V wootaler -e 1h -p
OIDC setup in WooCommerce
==================================
Install OIDC plugin:
sudo -u www-data wp --user=admin plugin install daggerhart-openid-connect-generic --activate
Find existing settings:
sudo -u www-data wp --user=admin option list
=> find out how to modify!
OpenID client ID is public key of identity:
$ gnunet-identity -d -e martin
So: 50BMJB6S9MV22BTG541G6XPQVNT7BNT7DZ3ZCCEZXFZPKV3915N0
Authorize Endpoint definieren im OpenID Connect Wordpress plugin zu ("Login Endpoint URL"):
https://api.reclaim/openid/authorize
Client secret key:
Siehe:
gnunet-config -s reclaim-rest-plugin -o OIDC_CLIENT_SECRET
default "secret"
OpenID scope: list of desired attributes:
"openid profile email full_name" ...
Token Validation Endpoint URL - wo GNUnet REST API erreichbar:
Default is: http://localhost:7776/openid/token
Userinfo Endpoint URL - analog:
http://localhost:7776/openid/token/userinfo
Identity key: immer "sub"
Nickname key: gut: full_name
Display name formatting: {full_name}
Identify with username: check box
===========================
Reclaim plugin installieren: https://addons.mozilla.org/en-US/firefox/addon/reclaimid/
GNUnet "lokal" installieren
Beide peers (WooCommerce+Reclaim und localen GNUnet peer "verbinden")
-- oder beim Export von GNUnet via qemu: bind_to von REST auf 0.0.0.0 setzen, damit Qemu zugriff erlaubt.
=============================
Integration Notes:
==================
Add OIDC button using (either)
get_checkout_fields( 'account' ) ) : ?>
get_checkout_fields( 'account' ) as $key => $field ) : ?>
get_value( $key ) ); ?>
of those hooks from
https://github.com/woocommerce/woocommerce/blob/bdf77f5648fb44b86b19ac4f8a01536b1ee6baa1/templates/checkout/form-billing.php
=> ideal: call hook of OIDC plugin that OIDC plugin installed for the 'main' login button of WordPress.
OIDC plugin uses existing hook
(see includes/openid-connect-generic-login-form.php) as this:
>>>
$login_form = new self( $settings, $client_wrapper );
add_filter( 'login_message', array( $login_form, 'handle_login_page' ), 99 );
add_shortcode( 'openid_connect_generic_login_button', array( $login_form, 'make_login_button' ) );
<<<
so something like this must be added to the hook above!
daggerhart-openid-connect-generic
=================================
Modify "Login with OpenID" to "Login with Re:claimID" using this hook:
#### `openid-connect-generic-login-button-text`
Modify the login button text. Default value is `__( 'Login with OpenID Connect' )`.
Provides 1 argument: the current login button text.
```
add_filter('openid-connect-generic-login-button-text', function( $text ) {
$text = __('Login to my super cool IDP server');
return $text;
});
```
* `openid-connect-generic-last-id-token-claim` - The user's most recent `id_token` claim, decoded and stored as an array.
=> here is the data we want from the user (to put into the woocommerce form)
Required fields in billing form:
NOTE: if 'email' is available, it is already used, seems I may not even need the hook!
{"billing":{"billing_first_name":{"label":"First name","required":true,"class":["form-row-first"],"autocomplete":"given-name","priority":10},"billing_last_name":{"label":"Last name","required":true,"class":["form-row-last"],"autocomplete":"family-name","priority":20},"billing_company":{"label":"Company name","class":["form-row-wide"],"autocomplete":"organization","priority":30,"required":false},"billing_country":{"type":"country","label":"Country \/ Region","required":true,"class":["form-row-wide","address-field","update_totals_on_change"],"autocomplete":"country","priority":40},"billing_address_1":{"label":"Street address","placeholder":"House number and street name","required":true,"class":["form-row-wide","address-field"],"autocomplete":"address-line1","priority":50},"billing_address_2":{"placeholder":"Apartment, suite, unit, etc. (optional)","class":["form-row-wide","address-field"],"autocomplete":"address-line2","priority":60,"required":false},"billing_city":{"label":"Town \/ City","required":true,"class":["form-row-wide","address-field"],"autocomplete":"address-level2","priority":70},"billing_state":{"type":"state","label":"State \/ County","required":false,"class":["form-row-wide","address-field"],"validate":["state"],"autocomplete":"address-level1","priority":80,"country_field":"billing_country","country":"AF"},"billing_postcode":{"label":"Postcode \/ ZIP","required":true,"class":["form-row-wide","address-field"],"validate":["postcode"],"autocomplete":"postal-code","priority":90},"billing_phone":{"label":"Phone","required":true,"type":"tel","class":["form-row-wide"],"validate":["phone"],"autocomplete":"tel","priority":100},"billing_email":{"label":"Email address","required":true,"type":"email","class":["form-row-wide"],"validate":["email"],"autocomplete":"email","priority":110}},"shipping":{"shipping_first_name":{"label":"First name","required":true,"class":["form-row-first"],"autocomplete":"given-name","priority":10},"shipping_last_name":{"label":"Last name","required":true,"class":["form-row-last"],"autocomplete":"family-name","priority":20},"shipping_company":{"label":"Company name","class":["form-row-wide"],"autocomplete":"organization","priority":30,"required":false},"shipping_country":{"type":"country","label":"Country \/ Region","required":true,"class":["form-row-wide","address-field","update_totals_on_change"],"autocomplete":"country","priority":40},"shipping_address_1":{"label":"Street address","placeholder":"House number and street name","required":true,"class":["form-row-wide","address-field"],"autocomplete":"address-line1","priority":50},"shipping_address_2":{"placeholder":"Apartment, suite, unit, etc. (optional)","class":["form-row-wide","address-field"],"autocomplete":"address-line2","priority":60,"required":false},"shipping_city":{"label":"Town \/ City","required":true,"class":["form-row-wide","address-field"],"autocomplete":"address-level2","priority":70},"shipping_state":{"type":"state","label":"State \/ County","required":false,"class":["form-row-wide","address-field"],"validate":["state"],"autocomplete":"address-level1","priority":80,"country_field":"shipping_country","country":"AF"},"shipping_postcode":{"label":"Postcode \/ ZIP","required":true,"class":["form-row-wide","address-field"],"validate":["postcode"],"autocomplete":"postal-code","priority":90}},"account":{"account_username":{"type":"text","label":"Account username","required":true,"placeholder":"Username"},"account_password":{"type":"password","label":"Create account password","required":true,"placeholder":"Password"}},"order":{"order_comments":{"type":"textarea","class":["notes"],"label":"Order notes","placeholder":"Notes about your order, e.g. special notes for delivery."}}}
=> new scope:
openid profile email full_name given-name family-name organization country address-line1 address-line2 address-level2 address-level1 postal-code tel