8000 Support storing application level info with authenticated peer's principal by sophokles73 · Pull Request #1014 · eclipse-californium/californium · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support storing application level info with authenticated peer's principal #1014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2019

Conversation

sophokles73
Copy link
Contributor

No description provided.

Signed-off-by: Kai Hudalla <kai.hudalla@bosch-si.com>
@sophokles73 sophokles73 requested a review from boaks July 16, 2019 09:34
@sophokles73
Copy link
Contributor Author

@boaks please wait with merging, I need to check something first ...

@sophokles73 sophokles73 force-pushed the add_principal_converter branch from 3728107 to d6921b0 Compare July 16, 2019 09:46
@sophokles73
Copy link
Contributor Author

@boaks ok, all set. I forgot to commit my latest changes ;-)
@sbernard31 does this work for you as well?

Copy link
Contributor
@sbernard31 sbernard31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit embarrassed to say that because I feel this is one of my remarks which brings to this change, but I didn't get so much the benefits of AdditionalInfo compared to a Map. 😅

No objections for me :-)

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 Institute for Pervasive Computing, ETH Zurich and others.
* Copyright (c) 2015, 2019 Institute for Pervasive Computing, ETH Zurich and others.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this class should not be modified but you find a unused import so why not :)

@@ -984,6 +991,7 @@ protected final void handshakeStarted() throws HandshakeException {
}

protected final void sessionEstablished() throws HandshakeException {
amendPeerPrincipal();
Copy link
Contributor
@sbernard31 sbernard31 Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't kown if amendPeerPrincipal shoud be in or out the if block 🤔

import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used.

@@ -984,6 +991,7 @@ protected final void handshakeStarted() throws HandshakeException {
}

protected final void sessionEstablished() throws HandshakeException {
amendPeerPrincipal();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume, that amendPeerPrincipal should only be called once per handshake. To ensure that, consider to move it after

if (!sessionEstablished) {
	sessionEstablished = true;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity: under what circumstances will sessionEstablished be already be true when this method is invoked?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your right. It was introduced to ensure, that this doesn't happen accidentally (may be in the future).
May be we convert that into an exception, but after 2.0.0-M16 .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that I should keep the method invocation at its current position?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want, you could keep it there.
I would still prefer to move it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will do

@boaks
Copy link
Contributor
boaks commented Jul 16, 2019

Is there a intended use-case, which requires the public Principal's constructors with the AdditionalInfo parameter? If not, I would remove them. Beside of that and the "small" comments above, LGTM.

@sophokles73
Copy link
Contributor Author
sophokles73 commented Jul 16, 2019

Is there a intended use-case, which requires the public Principal's constructors with the AdditionalInfo parameter? If not, I would remove them.

No, there isn't. Thanks for pointing this out. I will make them private or remove them altogether ...

@boaks
Copy link
Contributor
boaks commented Jul 16, 2019

The most could be removed, only one private with the most parameter is required.
For PreSharedKeyIdentity you may consider to remove the second private one (that with the additional "name").

@sophokles73 sophokles73 force-pushed the add_principal_converter branch from d6921b0 to 1f096de Compare July 16, 2019 14:08
The Principal instances created by Scandium when a client has been
authenticated contain only the authentication identifier used by the
client, e.g. the PSK identity or the client cert subject DN.

However, applications will often map the (technical) authentication
identifier used at the DTLS level to a logical application level
identifier which is used to refer to the client.

The ApplicationLevelInfoSupplier can be implemented by applications to
provide additional application level information for the (technical)
Principal created by Scandium. This additional information can then used
when processing CoAP requests in applications.

Signed-off-by: Kai Hudalla <kai.hudalla@bosch-si.com>
@sophokles73 sophokles73 force-pushed the add_principal_converter branch from 1f096de to 5aa226e Compare July 17, 2019 08:36
@sophokles73
Copy link
Contributor Author

@boaks I have moved the amendPeerPrincipal method ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0