Skip to content
This repository was archived by the owner on Dec 12, 2018. It is now read-only.

Commit 18149e4

Browse files
authored
1073: property name cleanup to be easier to understand (#1205)
1 parent c0ebbb2 commit 18149e4

File tree

3 files changed

+36
-36
lines changed

3 files changed

+36
-36
lines changed

docs/source/forwarded-request.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,9 @@ with in transit. JWTs are among the simplest and safest means of secure identity
624624
this approach to ensure best-in-class security by default.
625625

626626
If JWTs are not desirable - perhaps because you implicitly trust the network and machine transmission to your origin
627-
servers - you can disable the JWT approach entirely (see the ``enabled`` property below) and instead send a simple string
628-
value or JSON document as documented above If you don't have a preference however, it is recommended in most
629-
scenarios to retain the added security that JWTs can offer.
627+
servers - you can disable the JWT approach entirely (see the :ref:`enabled <forwarded account header jwt enabled>`
628+
property below) and instead send a simple string value or JSON document as documented above If you don't have a
629+
preference however, it is recommended in most scenarios to retain the added security that JWTs can offer.
630630

631631
.. tip::
632632

@@ -813,8 +813,8 @@ You may configure the signing key used to cryptographically sign the JWT via var
813813
not be able to verify the JWT's digital signature.
814814

815815
To avoid JWT key/parsing errors in your origin servers, we recommend that specify your own signing key via
816-
the :ref:`stormpath.zuul.account.header.jwt.key.k property <forwarded account signing key value>` or by defining the
817-
:ref:`stormpathForwardedAccountJwtSigningKey <forwarded account signing key bean>` bean.
816+
the :ref:`stormpath.zuul.account.header.jwt.key.value property <forwarded account signing key value>` or by
817+
defining the :ref:`stormpathForwardedAccountJwtSigningKey <forwarded account signing key bean>` bean.
818818

819819
Also please see the :ref:`signing key alg <forwarded account signing key alg>` section for more information.
820820

@@ -861,7 +861,7 @@ For example:
861861
If you are using an HMAC algorithm by specifying ``HS256``, ``HS384``, or ``HS512``, you can provide your HMAC
862862
symmetric key in one of two ways. Either:
863863

864-
A. Set the ``stormpath.zuul.account.header.jwt.key.k`` and ``stormpath.zuul.account.header.jwt.key.encoding``
864+
A. Set the ``stormpath.zuul.account.header.jwt.key.value`` and ``stormpath.zuul.account.header.jwt.key.encoding``
865865
config properties, or
866866

867867
B. Define the :ref:`stormpathForwardedAccountJwtSigningKey <forwarded account signing key bean>` bean.
@@ -897,7 +897,7 @@ If you're unsure, we recommend that you *do not* set this property.
897897
``encoding``
898898
""""""""""""
899899

900-
If you specified the text value of your HMAC signing key via the ``stormpath.zuul.account.header.jwt.key.k`` property,
900+
If you specified the text value of your HMAC signing key via the ``stormpath.zuul.account.header.jwt.key.value`` property,
901901
and that string is *not* Base64Url-encoded, you will need to set the ``stormpath.zuul.account.header.jwt.key.encoding``
902902
property to indicate which encoding is used. For example:
903903

@@ -910,25 +910,25 @@ property to indicate which encoding is used. For example:
910910
header:
911911
jwt:
912912
key:
913-
k: EQDGRjSpZB87/eWO42XQ7h7mfxk0EmF6ZDY0TDGdAoA=
913+
value: EQDGRjSpZB87/eWO42XQ7h7mfxk0EmF6ZDY0TDGdAoA=
914914
encoding: base64
915915
916916
917917
The default/assumed encoding is ``base64url``. There are two other supported encodings:
918918

919919
* ``base64``: standard Base64 encoding (not URL encoded)
920-
* ``utf8``: direct UTF-8 bytes of the configured string, i.e. ``k.getBytes(StandardCharsets.UTF8)``
920+
* ``utf8``: direct UTF-8 bytes of the configured string, i.e. ``value.getBytes(StandardCharsets.UTF8)``
921921

922922
**CAUTION**: these 3 text encodings are not cryptographically secure. Please see the
923923
:ref:`key caution <forwarded account signing key value caution>` concerning key string values.
924924

925925
.. _forwarded account signing key value:
926926

927-
``k``
928-
"""""
927+
``value``
928+
"""""""""
929929

930930
If you want to configure your HMAC signing key as a string, you can set the
931-
``stormpath.zuul.account.header.jwt.key.k`` property. For example:
931+
``stormpath.zuul.account.header.jwt.key.value`` property. For example:
932932

933933
.. code-block:: yaml
934934
@@ -938,13 +938,13 @@ If you want to configure your HMAC signing key as a string, you can set the
938938
header:
939939
jwt:
940940
key:
941-
k: EQDGRjSpZB87_eWO42XQ7h7mfxk0EmF6ZDY0TDGdAoA
941+
value: EQDGRjSpZB87_eWO42XQ7h7mfxk0EmF6ZDY0TDGdAoA
942942
943943
944-
By default, the value is expected to be a Base64Url string. The |project| will then base64url-decode this value
944+
By default, the key value is expected to be a Base64Url string. The |project| will then base64url-decode this value
945945
at startup to obtain the raw signing key bytes used to compute the JWT signature.
946946

947-
If your string value is not Base64Url, you can specify the ``stormpath.zuul.account.header.jwt.key.encoding``
947+
If your value string is not Base64Url, you can specify the ``stormpath.zuul.account.header.jwt.key.encoding``
948948
config property to indicate which encoding is used.
949949

950950
.. _forwarded account signing key value caution:
@@ -954,13 +954,13 @@ config property to indicate which encoding is used.
954954
**Base64, Base64Url and UTF-8 encoding DOES NOT imply encryption**.
955955

956956
Anyone that can access the
957-
``stormpath.zuul.account.header.jwt.key.k`` string value can use it to sign JWTs as you. Keep this text string (and
957+
``stormpath.zuul.account.header.jwt.key.value`` string value can use it to sign JWTs as you. Keep this text string (and
958958
the configured property value) safe and secret.
959959

960960
If you are uncomfortable embedding key strings in your configuration due to security concerns, we recommend
961961
any of three approaches:
962962

963-
1. Specify the ``stormpath.zuul.account.header.jwt.key.k`` value as an
963+
1. Specify the ``stormpath.zuul.account.header.jwt.key.value`` value as an
964964
`external Spring Boot property <https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html>`_.
965965
For example, set the ``STORMPATH_ZUUL_ACCOUNT_HEADER_JWT_KEY_K`` environment variable via an operations
966966
orchestration mechanism like Chef, Puppet or CloudFoundry that has access to secure/encrypted data store for
@@ -970,21 +970,21 @@ config property to indicate which encoding is used.
970970
to securely represent key values as text properties in your config. Spring Cloud Config Server will decrypt
971971
the text value just before giving it to the |project| so it may be used correctly.
972972

973-
3. Do not configure the ``stormpath.zuul.account.header.jwt.key.k`` property and instead define your own
973+
3. Do not configure the ``stormpath.zuul.account.header.jwt.key.value`` property and instead define your own
974974
:ref:`stormpathForwardedAccountJwtSigningKey <forwarded account signing key bean>` bean. You can then load the
975975
key bytes in whatever secure way you prefer.
976976

977977

978-
``kid``
979-
"""""""
978+
``id``
979+
""""""
980980

981981
When specifying a signing key, it is usually recommended to also specify a string identifier for the key in the JWT
982982
header. This allows JWT recipients (i.e. your origin servers) the ability to inspect the JWT header and identify which
983983
signing key was used. Based on this identifier, the JWT recipient can then look up the corresponding key
984984
(or public key) to use in order to correctly verify the JWT's digital signature.
985985

986-
You can specify your signing key's id (the ``kid`` param in the JWT header) by setting the
987-
``stormpath.zuul.account.header.jwt.key.kid`` configuration property. For example:
986+
You can specify your signing key's id (the ``id`` param in the JWT header) by setting the
987+
``stormpath.zuul.account.header.jwt.key.id`` configuration property. For example:
988988

989989
.. code-block:: yaml
990990
@@ -994,7 +994,7 @@ You can specify your signing key's id (the ``kid`` param in the JWT header) by s
994994
header:
995995
jwt:
996996
key:
997-
kid: my signing key id
997+
id: my signing key id
998998
999999
10001000
This will set the JWT's ``kid`` header accordingly.
@@ -1167,7 +1167,7 @@ configuration:
11671167
11681168
11691169
You can also define this bean to provide your symmetric key for HMAC algorithms as well if you prefer not to
1170-
configure the HMAC signing key using the ``stormpath.zuul.account.header.jwt.key.k`` config property.
1170+
configure the HMAC signing key using the ``stormpath.zuul.account.header.jwt.key.value`` config property.
11711171

11721172

11731173
Custom Header Value

extensions/spring/cloud/stormpath-zuul-spring-cloud-starter/src/main/java/com/stormpath/spring/cloud/zuul/autoconfigure/StormpathZuulAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@ protected static SignatureAlgorithm getAlgorithm(byte[] hmacSigningKeyBytes) {
167167
signatureAlgorithm = SignatureAlgorithm.forName(value);
168168
}
169169

170-
String kid = jwk.getKid();
170+
String kid = jwk.getId();
171171

172172
key = stormpathForwardedAccountJwtSigningKey(); //check if explicitly provided as a bean
173173

174174
if (key == null) {
175175

176176
byte[] bytes = null;
177177

178-
String encodedKeyBytes = jwk.getK();
178+
String encodedKeyBytes = jwk.getValue();
179179
if (encodedKeyBytes != null) {
180180

181181
String encoding = jwk.getEncoding();

extensions/spring/cloud/stormpath-zuul-spring-cloud-starter/src/main/java/com/stormpath/spring/cloud/zuul/config/JwkConfig.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public class JwkConfig {
2626

2727
private String encoding;
2828

29-
private String k;
29+
private String value;
3030

31-
private String kid;
31+
private String id;
3232

3333
public JwkConfig() {
3434
this.enabled = true;
@@ -58,19 +58,19 @@ public void setEncoding(String encoding) {
5858
this.encoding = encoding;
5959
}
6060

61-
public String getK() {
62-
return k;
61+
public String getValue() {
62+
return value;
6363
}
6464

65-
public void setK(String k) {
66-
this.k = k;
65+
public void setValue(String value) {
66+
this.value = value;
6767
}
6868

69-
public String getKid() {
70-
return kid;
69+
public String getId() {
70+
return id;
7171
}
7272

73-
public void setKid(String kid) {
74-
this.kid = kid;
73+
public void setId(String id) {
74+
this.id = id;
7575
}
7676
}

0 commit comments

Comments
 (0)