Skip to content

Commit

Permalink
fixup! chore!: do not expose the TD ID via AugmentedForms
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 27, 2025
1 parent 5509b2d commit 314eab9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
16 changes: 4 additions & 12 deletions example/complex_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,16 @@ const thingDescriptionJson = {
},
};

final Map<Uri, BasicCredentials> basicCredentials = {
Uri.parse("https://httpbin.org"):
const BasicCredentials("username", "password"),
final Map<String, BasicCredentials> basicCredentials = {
"httpbin.org": const BasicCredentials("username", "password"),
};

Future<BasicCredentials?> basicCredentialsCallback(
Uri uri,
AugmentedForm? form,
BasicCredentials? invalidCredentials,
) async {
final href = Uri(
scheme: uri.scheme,
host: uri.host,
port: uri.port,
);

return basicCredentials[href];
}
) async =>
basicCredentials[uri.authority];

Future<void> main() async {
final coapClientFactory = CoapClientFactory(
Expand Down
19 changes: 4 additions & 15 deletions example/http_basic_authentication.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,16 @@ const thingDescriptionJson = {

const basicCredentials = BasicCredentials("username", "password");

final Map<Uri, BasicCredentials> basicCredentialsMap = {
Uri.parse("https://httpbin.org"): basicCredentials,
final Map<String, BasicCredentials> basicCredentialsMap = {
"httpbin.org": basicCredentials,
};

Future<BasicCredentials?> basicCredentialsCallback(
Uri uri,
AugmentedForm? form,
BasicCredentials? invalidCredentials,
) async {
if (form == null) {
return basicCredentials;
}

final href = Uri(
scheme: uri.scheme,
host: uri.host,
port: uri.port,
);

return basicCredentialsMap[href];
}
) async =>
basicCredentialsMap[uri.authority];

/// Illustrates the usage of both the basic and the automatic security scheme,
/// with a server supporting basic authentication.
Expand Down
15 changes: 4 additions & 11 deletions example/mqtt_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const thingDescriptionJson = {
},
};

final Map<Uri, BasicCredentials> basicCredentials = {
Uri.parse("mqtt://test.mosquitto.org:1884"): const BasicCredentials(
final Map<String, BasicCredentials> basicCredentials = {
"test.mosquitto.org:1884": const BasicCredentials(
"rw",
"readwrite",
),
Expand All @@ -56,15 +56,8 @@ Future<BasicCredentials?> basicCredentialsCallback(
Uri uri,
AugmentedForm? form, [
BasicCredentials? invalidCredentials,
]) async {
final href = Uri(
scheme: uri.scheme,
host: uri.host,
port: uri.port,
);

return basicCredentials[href];
}
]) async =>
basicCredentials[uri.authority];

Future<void> main(List<String> args) async {
final servient = Servient.create(
Expand Down

0 comments on commit 314eab9

Please sign in to comment.