Commit Graph

75 Commits

Author SHA1 Message Date
pbatko-da
ee6a5f9e0e
Handle misc error codes todos. [DPP-606] (#13248)
changelog_begin
changelog_end
2022-03-14 17:16:31 +01:00
pbatko-da
877713edd3
Move validation error helpers out of ErrorFactories [DPP-606] (#13180)
changelog_begin
changelog_end
2022-03-08 17:15:26 +01:00
pbatko-da
c7c211e4df
Remove most of ErrorFactories [DPP-606] (#13146)
changelog_begin
changelog_end
2022-03-07 16:15:21 +01:00
pbatko-da
af27f5d926
Make ErrorFactories into an object in preparation for its removal. [DPP-606] (#13143)
changelog_begin
changelog_end
2022-03-04 09:35:38 +01:00
Stephen Compall
7c1cf567ad
use user token for trigger service sandbox test fixture (#13077)
In SandboxFixture when mixing in the auth middleware fixture, set
up the ledger client with a user token instead of a claims token
when not running in the claims-token-specific auth tests.

Fixes #12831.

* note about inClaims

* prevent Product, Serializable warts with AuthServiceJWTPayload

CHANGELOG_BEGIN
CHANGELOG_END
2022-02-25 14:08:44 -05:00
Moritz Kiefer
5e86c75ef8
Fix merge conflict in user mgmt (#12986)
98d5bd5f53
and
9d831ff122
don’t get along.

changelog_begin
changelog_end
2022-02-17 16:18:55 +00:00
Marton Nagy
9d831ff122
[User management] Some cleanup to ongoing-stream-authorization [DPP-830] (#12851)
changelog_begin
changelog_end
2022-02-17 15:35:41 +01:00
Kamil Bozek
dfd38186fe
Remove pre-1.18 error codes [DPP-773] (#12841)
* Remove legacy error codes

CHANGELOG_BEGIN
CHANGELOG_END

* Remove ValidatorFixture

* Removed redundant helper function

* Remove redundant object

* Rebased.

run-full-compat: true

* Rebased.

run-full-compat: true
2022-02-15 15:28:36 +01:00
pbatko-da
f2b7902c68
[User management] Add CreateUserResponse and GetUserResponse gRPC response wrappers [DPP-854] (#12682)
changelog_begin
Ledger API Specification: CreateUser and GetUser endpoints of UserManagementService now return the CreateUserResponse or GetUserResponse messages, whereas previously they were returning the User message).
changelog_end
2022-02-08 12:29:57 +01:00
pbatko-da
6926e9adb4
Deprecate user identity service [DPP-862] (#12694)
changelog_begin
Ledger API Specification: Ledger Identity service is now deprecated.
changelog_end
2022-02-04 10:32:09 +01:00
pbatko-da
c72c27c967
[User management] Terminate ongoing streams when user state has changed [DPP-830] (#12437)
CHANGELOG_BEGIN
Ledger API Specification: When using user management based authorization streams will now get aborted on authenticated user's rights change.
CHANGELOG_END
2022-01-28 16:44:39 +01:00
pbatko-da
42d86acd06
[User management] Disabling user management in auth when user management feature is disabled [DPP-827] (#12503)
CHANGELOG_BEGIN
CHANGELOG_END
2022-01-25 09:55:37 +01:00
Stefano Baghino
f1cd4b1c7c
Remove dependencies on compatibility libraries (#12548)
Continues the work started in https://github.com/digital-asset/daml/pull/12543

These libraries were only needed to transition from Scala 2.12 to 2.13
and are no longer useful as all the necessary items are now available
in Scala 2.13.

changelog_begin
changelog_end
2022-01-24 18:04:07 +00:00
Simon Maxen
cbb4986e89
Add Empty GRPC Metering Report Service [DPP-856] (#12515)
* With mock metering service

* Reformat

changelog_begin
changelog_end

* Include nanos in generation time

* Update with review comments

* Update service count
2022-01-21 16:39:16 +00:00
Simon Meier
0f8e40c92d
user management: add reference docs (#12398)
CHANGELOG_BEGIN
CHANGELOG_END
2022-01-20 10:32:28 +00:00
mziolekda
954bc5e0d4
Remove the reset service from sandbox-classic and sandbox [DPP-804] (#12448)
* Remove the reset service from sandbox-classic and sandbox

CHANGELOG_BEGIN
Reset service has been removed from the sandbox-classic, sandbox and daml-on-sql
CHANGELOG_END

* format it
2022-01-19 09:18:14 +01:00
Simon Meier
2640bc6ab7
user management: require appropriate scope in user access tokens (#12428)
* user management: require `daml_ledger_api` scope in user access tokens

The accesss token's scope must include `daml_ledger_api` to ensure
that access token was issued for accessing the Daml ledger api.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-18 13:01:47 +00:00
Simon Meier
82bdfa5222
ledger-api-auth: remove SupportedJWTPayload (#12343)
* ledger-api-auth: make AuthServiceJWTPayload parse both user and custom daml access tokens

changelog_begin
changelog_end
2022-01-13 16:12:13 +00:00
Simon Meier
62b61c0d51
ledger api auth: polish error messages (#12350)
* ledger api auth: polish error messages

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-11 18:16:59 +00:00
Simon Meier
a88d875c9a
auth tokens: support legacy sandbox format even with standard JWT claims present (#12297)
Fixes  #12285

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-07 10:33:47 +01:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Marton Nagy
115fbba799
Introducing DbSupport, pulling up DbDispatcher building in the factory hierarchies (#12152)
This PR prepares the landscape for seamless integration of Index DB with non IndexService related
front components like UserManagementStore.
DbSupport is a simply a DbDispatcher and a StorageBackendFactory. Creation of it comes also in Flyway migrated flavor for capturing common need.
This is a pure refactoring PR: no behavior/feature changes

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-16 08:49:20 +01:00
Simon Meier
81990bc8b3
Fix #12133: correct error for tokens with invalid user-ids (#12134)
* Fix #12133: correct error for tokens with invalid user-ids

- also changes the error for a token referring to an unknown user from `UNAUTHENTICATED` to `PERMISSION_DENIED`

CHANGELOG_BEGIN
CHANGELOG_END
2021-12-14 21:01:12 +00:00
Simon Meier
8c1173c8f1
User management application id defaulting (#12100)
user management: add defaulting for the application_id field of requests

CHANGELOG_BEGIN
- [Ledger API]: as a convenience when using JWT authentication, a
  request's application_id field can be left empty to ask the server to
  set the field to the id of the authenticated user or the application-id
  in the custom token. There are three services that currently specify
  application_id's in the request: CommandService,
  CommandSubmissionService, and CommandCompletionService.
CHANGELOG_END
2021-12-14 17:57:09 +00:00
Simon Meier
75863c392f
Fix #12129: allow users' access to their own info (#12132)
CHANGELOG_BEGIN
CHANGELOG_END
2021-12-14 11:15:17 +00:00
Simon Meier
f223528bfb
Implement PoC of user management for Ledger API server (fix #12014) (#12063)
CHANGELOG_BEGIN
- [User Management]: add support for managing participant node users and authenticating
  requests as these users using standard JWT tokens.
CHANGELOG_END

Co-authored-by: Marton Nagy <marton.nagy@digitalasset.com>
Co-authored-by: Adriaan Moors <90182053+adriaanm-da@users.noreply.github.com>
2021-12-13 17:58:30 +01:00
tudor-da
cf3ac011ca
[Self-service error codes] Do not return error code id and definite_answer in metadata for security sensitive errors (#11828)
* [Self-service error codes] Do not return error code id in metadata

CHANGELOG_BEGIN
CHANGELOG_END

* Do not propagate definite_answer
* Additionally, remove redundant context info from error codes

* Fix tests

* Create IndexDbException as a specialization
* Used to globally define error codes returned by the persistence layer
that are logging
2021-11-25 12:42:29 +01:00
tudor-da
811a6d3ed6
Fixed AuthorizationInterceptorSpec again (#11418)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-26 22:33:02 +02:00
tudor-da
b14077a607
Fix AuthorizationInterceptorSpec flake (#11387)
CHANGELOG_BEGIN
CHANGELOG_END
2021-10-25 21:18:37 +02:00
tudor-da
f9e67adafc
[Self-service error codes] Adapt error responses in ledger-api-auth [DPP-617] (#11223)
* [Self-service error codes] Implement V2 in Authorizer

CHANGELOG_BEGIN
CHANGELOG_END

* Added unit test for authorize (non-streamed)

* Fix after rebase

* Do not expose the error codes switching mechanism to the Java bindings

* Adjust InternalAuthorizationError to be SystemInternalAssumptionViolated

* Parameter names in test

* Testing AuthorizationInterceptor with regard to returned error codes

* Do not use default error code version switchers at instance creation

* Addressed Pawel's review comments

* Using ErrorFactories for error dispatching

* Pass loggingContext to Authorizer where available

* Generic internal authorization error
2021-10-20 13:28:21 +00:00
tudor-da
2fc7490df2
[Self-service error codes] Adapt error factories [DPP-656] (#11270)
* Moved ErrorCodesVersionSwitcher to //ledger/error

CHANGELOG_BEGIN
CHANGELOG_END

* Rename ErrorCodeLoggingContext to ContextualizedErrorLogger

* Refactored ErrorFactories
* All error factories use ContextualizedErrorLogger for being able to dispatch self-service error codes.
* The ContextualizedErrorLogger is passed down from the dispatching Ledger API services.
* ErrorFactoriesSpec asserts both legacy (V1) and self-service error codes (V2).

* Adapted ApiSubmissionService

* Addressed Marcin's review comments
2021-10-18 16:46:20 +02:00
Samir Talwar
4b8b67a1b5
Upgrade Scalatest to v3.2.9. (#10576)
* Upgrade Scalatest to v3.2.9.

Because of some coupling we also have to upgrade Scalaz to the latest
v7.2 point release, v7.2.33.

The Scalatest changes are quite involved because the JAR has been broken
up into several smaller JARs. Because Bazel expects us to specify all
dependencies and doesn't allow transitive dependencies to be used
directly, this means that we need to specify the explicit Scalatest
components that we use.

As you can imagine, this results in quite a big set of changes. They
are, however, constrained to dependency management; all the code remains
the same.

CHANGELOG_BEGIN
CHANGELOG_END

* http-json-oracle: Fix a Scalatest dependency.

* ledger-api-client: Fix a Scalatest dependency.
2021-08-12 23:19:35 +00:00
Samir Talwar
c3bc26fd1c
daml-lf/data: Move ID aliases to Ref from _ledger-api-common_. [KVL-1002] (#10323)
* daml-lf/data: Move ID aliases to `Ref` from _ledger-api-common_.

This allows us to remove a lot of dependencies on _ledger-api-common_,
and use these aliases in other places where that module is not used.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Remove an unused import.

* http-json-oracle: Remove `ledger-api-common` as a dependency.

* bindings-rxjava: Remove a now-unused dependency.
2021-07-20 11:01:19 +00:00
Miklos
b1ca310866
ledger: Damlification of Scala files (#9667)
* Damlification of Scala files (primarily comments and strings).

* Corrected a typo.
CHANGELOG_BEGIN
CHANGELOG_END

* Fixed build.

* Fixed test case for acronyms.

* Reformatted.
2021-05-20 10:21:04 +00:00
Kamil Bożek
32d4bf92ec
Do not require a JWT token for Health and Reflection services [DPP-277] (#8969)
* Do not require a JWT token for Health and Reflection services

CHANGELOG_BEGIN
- A JWT token is no longer required to call methods of Health and Reflection services
CHANGELOG_END

* Let service's authorizer decide about rejections

* Updated authorization test

* Added integration test for unsecured authorisation test for the Health service

* Added integration test for unsecured authorisation test for the Server Reflection service

* Updated Claims doc comments

* Minor change

* Reduced code duplication with SecuredServiceCallAuthTests and UnsecuredServiceCallAuthTests

* Added copyrights

* Move response status handling logic to Authorizer
2021-03-03 11:05:35 +00:00
Moritz Kiefer
6b2ac0e0c6
Port parts of //ledger/... to Scala 2.13 (#8470)
* Port parts of //ledger/... to Scala 2.13

Fairly random choice of directories, I just went through them in
alphabetical order. The one thing that I had to disable for now are
the conformance tests since the ledger API test tool has a dependency
not compatible with Scala 2.13.

changelog_begin
changelog_end

* Remove accidentally included //ledger/ledger-api-client/...

doesn’t actually work yet

changelog_begin
changelog_end
2021-01-12 10:55:00 +01:00
Moritz Kiefer
aebde84842
Upgrade scopt to 4.0.0 (#8466)
* Upgrade scopt to 4.0.0

Scopt 3.x has some issues with Scala 2.13 because it expects an
immutable Seq on 2.13 meaning you cannot just pass in an Array. Rather
than fixing our callsites to convert to an immutable Seq everywhere,
this PR bumps to Scopt 4.0 which goes back to collection.Seq.

and leaving that aside, I’m a fan of upgrading dependencies anyway :)

changelog_begin
changelog_end

* Use val instead of def

changelog_begin
changelog_end
2021-01-11 21:23:02 +01:00
Moritz Kiefer
22ce940954
Upgrade scalafmt and enable trailing commas (#8437)
This PR updates scalafmt and enables trailingCommas =
multiple. Unfortunately, scalafmt broke the version field which means
we cannot fully preserve the rest of the config. I’ve made some
attempts to stay reasonably close to the original config but couldn’t
find an exact equivalent in a lot of cases. I don’t feel strongly
about any of the settings so happy to change them to something else.

As announced, this will be merged on Saturday to avoid too many conflicts.

changelog_begin
changelog_end
2021-01-09 11:37:37 +01:00
Moritz Kiefer
424faa923a
Port damlc dependencies to Scala 2.13 (#8423)
* Port damlc dependencies to Scala 2.13

I got a bit fed up by the fact that going directory by directory
didn’t really work since there are two many interdependencies in
tests (e.g., client tests depend on sandbox, sandbox tests depend on
clients, engine tests depend on DARs which depend on damlc, …).

So before attempting to continue with the per-directory process, this
is a bruteforce approach to break a lot of those cycles by porting all
dependencies of damlc which includes client bindings (for DAML Script)
and Sandbox Classic (also for DAML Script).

If this is too annoying to review let me know and I’ll try to split it
up into a few chunks.

changelog_begin
changelog_end

* Update daml-lf/data/src/main/2.13/com/daml/lf/data/LawlessTraversals.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* fixup lawlesstraversal

changelog_begin
changelog_end

* less iterator more view

changelog_begin
changelog_end

* document safety of unsafeWrapArray

changelog_begin
changelog_end

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-01-08 07:22:38 +01:00
Samir Talwar
c68ba11080
participant-integration-api: Dedicated execution context for requests. (#7945)
* participant-integration-api: Dedicated execution context for requests.

CHANGELOG_BEGIN
CHANGELOG_END

* participant-integration-api: Construct the services executor outside.

* participant-integration-api: Share the services EC with the GRPC stack.

* participant-integration-api: Use the new EC wherever possible.

And stop using DirectExecutionContext.

* sandbox-classic: Fix DevModeIT to use the right configuration.

I have no idea why this breaks now, but it was always technically
broken, so I'm fixing it.

* participant-integration-api: Push the services EC up one more level.

* Update newly added ApiParticipantPruning service accordingly

see https://github.com/digital-asset/daml/pull/7988#discussion_r525319097

* participant-integration-api: Ensure the LedgerConfigProvider is ready.

Somehow this slipped through.

* sandbox-classic: Fix `DefaultConfig` in tests.

* language-support/java: Disable seeding in tests again.

Co-authored-by: Oliver Seeliger <oliver.seeliger@digitalasset.com>
2021-01-05 18:11:54 +00:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Moritz Kiefer
7e05dc7932
Upgrade rules-scala and scalatest (#8187)
This is necessary to at least attempt an upgrade to 2.13 and
generally, I want to keep our rulesets up2date. rules-scala forces the
version of scalatest so we have to bump that at the same time.

This requires changes to basically all Scala test suites since the
import structure has changed and a bunch of things (primarily
scalacheck support) got split out.

Apologies for the giant PR, I don’t see a way to keep it smaller.

changelog_begin
changelog_end
2020-12-08 06:59:23 +01:00
Robert Autenrieth
56f5cf107b
Prepare the ledger API for multi-party submissions [KVL-710] (#8125)
* Add multi-party submissions to the ledger API

CHANGELOG_BEGIN
* [Ledger API] Command submission requests now contain new optional
  fields used for multi-party submissions. Such submissions currently
  return UNIMPLEMENTED errors, they will be enabled in the future.
CHANGELOG_END

* Adapt Haskell bindings

* Handle the new ledger API fields

* Fix SubmitAndWaitDummyCommand

* Remove unused methods

* Redesign multi-party auth tests

* Remove direct access of request party

* Apply review comments

* Improve protobuf comments

* Multi-party tracker map

* Fix validation logic

* Consistent metric naming
2020-12-07 16:17:05 +01:00
Samir Talwar
052f69cde9
ledger-api: Use proto_jars, and publish Protobuf sources separately from the Scala classes. [KVL-714] (#8091)
* ledger-api: Use `proto_jars`.

CHANGELOG_BEGIN
- [Ledger API] The Scala JARs containing the gRPC definitions no longer
  contain the *.proto files used to generate the ScalaPB-based classes.
CHANGELOG_END

* Create a source JAR for *.proto files in `proto_jars`.

* ledger-api: Publish the protobuf sources as "ledger-api-proto".

CHANGELOG_BEGIN
- [Ledger API] The *.proto files containing the gRPC definitions are now
  provided by a new Maven Central artifact, with the group "com.daml"
  and the artifact name "ledger-api-proto".
CHANGELOG_END

* release: We don't need the "main-jar" option.

* Bazel: Proto JARs will always have a Maven artifact suffix.

* Bazel: Simplify Protobuf source file TAR and JAR targets.

* Bazel: Extract out Protobuf functions.
2020-11-27 17:14:48 +00:00
Oliver Seeliger
83f11aa784
Participant pruning ledger api server support ported from Canton (#7988)
* Participant pruning ledger api server support ported from Canton

CHANGELOG_BEGIN
- [Ledger API]: The preview of `ParticipantPruningService` enables ledger participants to prune the "front" of ledger state at the participant including the ledger api server index.
CHANGELOG_END

* Review feedback from Stefano

* Add pruning tests plus missed command completions change

* Review feedback from Robert

* Improved test readability by having populate helper return offsets

* Review feedback

* Ledger api changes to pruning api and disable canton pruning test

- Change return result to PruneResponse
- Change type of PruneRequest.prune_up_to to string

* Review feedback: Use ApiOffsetSConverter for logged offsets
2020-11-23 15:28:04 +01:00
Samir Talwar
f0c1eb207c
concurrent: Tag DirectExecutionContext. (#7517)
* concurrent: Tag DirectExecutionContext.

1.  Tag `DirectExecutionContext` as `ExecutionContext[Nothing]`, thereby
    stating that it works for any tagged `Future`.
2.  Move `DirectExecutionContext` to the _libs-scala/concurrent_
    library, as it requires it and it's tiny.

CHANGELOG_BEGIN
CHANGELOG_END

* concurrent: Fix the privacy of `DirectExecutionContextInternal`.

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-09-29 17:23:57 +00:00
Samir Talwar
ebcbe2762f
ledger-api-auth: Extract Main in to a separate Bazel target. (#7497)
We don't need to push `Main` (and its dependency on `scopt`) to Maven
Central.

CHANGELOG_BEGIN
CHANGELOG_END
2020-09-28 11:27:01 +00:00
Stephen Compall
c3e79878ff
remove unused definitions, params, args from ledger API Scala code (#6985)
* remove unused definitions, params, args from ledger API Scala code

CHANGELOG_BEGIN
- [Ledger API] withTimeProvider removed from CommandClient; this method
  has done nothing since the new ledger time model was introduced in
  1.0.0.  See `issue #6985 <https://github.com/digital-asset/daml/pull/6985>`__.
CHANGELOG_END

* percolate withTimeProvider and label removal elsewhere
2020-08-04 18:02:19 +00:00
Robert Autenrieth
46b87c392d
Log all authorization errors (#6857)
* Log all authorization errors

CHANGELOG_BEGIN
- [Ledger API Server] The ledger API server now prints detailed log messages
  whenever a request was rejected due to a failed
  authorization.
CHANGELOG_END
2020-07-28 06:39:39 +02:00
Robert Autenrieth
a03a1ecc0b
Add basic participant integration API scaladoc (#6790)
* Add basic scaladoc

for participant integration API

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-20 21:31:32 +02:00