Skip to content
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

Rename ApplicationData in Registration ? #1440

Open
sbernard31 opened this issue Apr 21, 2023 · 2 comments
Open

Rename ApplicationData in Registration ? #1440

sbernard31 opened this issue Apr 21, 2023 · 2 comments
Labels
discussion Discussion about anything

Comments

@sbernard31
Copy link
Contributor

sbernard31 commented Apr 21, 2023

In Registration we have a way to attach "custom" data.

The idea :
When a client tries to register, a Leshan server could need to call external services to know if client is authorized to register.
This is done in Authorizer. During this authorization step, you could get some data (collected from that services) that you want to attach to registration (kind of optimization to avoid to recall that services later).

(See :#1018 and #1293 and for more details)

Currently this looks like :

public class Registration {
     // ... 
    /**
     * @return Some application data which could have been added at Registration by the {@link Authorizer}
     */
    public Map<String, String> getApplicationData() {
        return applicationData;
    }
    // ...
}
/**
 * This class is responsible to authorize up-link request from LWM2M client.
 */
public interface Authorizer {

    /**
     * Return an approved {@link Authorization}, if this request should be handled by the LWM2M Server. when a
     * declined{@link Authorization} is returned the LWM2M server will stop to handle this request and will respond with
     * a {@link ResponseCode#FORBIDDEN} or {@link ResponseCode#BAD_REQUEST}.
     * <p>
     * Some Application Data could be attached to on approved {@link Authorization} using :
     *
     * <pre>
     * return Authorization.approved(myAppData);
     * </pre>
     *
     * @param request the request received
     * @param registration the registration linked to the received request.<br>
     *        For register request this is the registration which will be created<br>
     *        For update request this is the registration before the update was done.
     * @param senderIdentity the {@link Identity} used to send the request.
     *
     * @return an {@link Authorization} status.
     */
    Authorization isAuthorized(UplinkRequest<?> request, Registration registration, Identity senderIdentity);
}

The issue:
ApplicationData is maybe not clear enough, see : #1237 (comment)

Proposed alternatives :

  • UserData
  • UserDefinedData
  • MetaData

What should we do ?

Do you think we should change that name ? or is ApplicationData clear enough ?
If you want to change it let us know which name you prefer ?
(If you want to add more alternatives name let us know too)

Note that this will break the API and maybe the redis serialization but if we think changing the name will make the code clearer, we should not be stopped by this.

@sbernard31 sbernard31 added the discussion Discussion about anything label Apr 21, 2023
@sbernard31
Copy link
Contributor Author

My current opinion, I don't like MetaData because I feel this is not really registration metadata.

UserData / UserDefinedData is OK to me.

I don't know what is the name generally used for this kind of data ? If you have some example do not hesitate to share.

@jvermillard, @msangoi, @JaroslawLegierski , @Warmek any opinions ?

@JaroslawLegierski
Copy link
Contributor

The name "UserDefinedData" sounds good.

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

No branches or pull requests

2 participants