summaryrefslogtreecommitdiff
path: root/reclaim-notes.txt
blob: ee54f09838456fca3269113750c6861c63bce262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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)

		<?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>

		<?php if ( $checkout->get_checkout_fields( 'account' ) ) : ?>

			<div class="create-account">
				<?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
					<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
				<?php endforeach; ?>
				<div class="clear"></div>
			</div>

		<?php endif; ?>

		<?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>

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