├── src
├── pkgs
│ └── Altinn.Register.Contracts
│ │ ├── version.txt
│ │ ├── Version.props
│ │ ├── Directory.Build.props
│ │ ├── test
│ │ └── Altinn.Register.Contracts.Tests
│ │ │ ├── Snapshots
│ │ │ ├── SystemUserTests.MinimalSystemUser.verified.json
│ │ │ ├── UnknownPartyTests.MinimalUnknownParty.verified.json
│ │ │ ├── EnterpriseUserTests.MinimalEnterpriseUser.verified.json
│ │ │ ├── PersonTests.MinimalPerson.verified.json
│ │ │ ├── SelfIdentifiedUserTests.MinimalSelfIdentifiedUser.verified.json
│ │ │ ├── OrganizationTests.MinimalOrganization.verified.json
│ │ │ ├── ExternalRoleAssignmentTests.ExternalRoleAssignment_KnownSource.verified.json
│ │ │ ├── ExternalRoleAssignmentTests.ExternalRoleAssignment_UnknownSource.verified.json
│ │ │ ├── SelfIdentifiedUserTests.MaximalSelfIdentifiedUser.verified.json
│ │ │ ├── SystemUserTests.MaximalSystemUser.verified.json
│ │ │ ├── SystemUserTests.MaximalSystemUser_Agent.verified.json
│ │ │ ├── EnterpriseUserTests.MaximalEnterpriseUser.verified.json
│ │ │ ├── UnknownPartyTests.UnknownPartyWithExtensions.verified.json
│ │ │ └── OrganizationTests.MaximalOrganization.verified.json
│ │ │ ├── ModuleInitializer.cs
│ │ │ └── Altinn.Register.Contracts.Tests.csproj
│ │ └── src
│ │ └── Altinn.Register.Contracts
│ │ ├── SelfIdentifiedUser.cs
│ │ ├── V1
│ │ ├── PartyNamesLookup.cs
│ │ ├── PartyNamesLookupResult.cs
│ │ ├── PartyComponentOptions.cs
│ │ ├── PersonNameComponents.cs
│ │ ├── PartyType.cs
│ │ └── PartyName.cs
│ │ ├── EnterpriseUser.cs
│ │ ├── IExternalRoleRef.cs
│ │ ├── MailingAddress.cs
│ │ ├── SystemUser.cs
│ │ ├── ExternalRoleAssignment.cs
│ │ ├── SystemUserType.cs
│ │ ├── PartyRef.cs
│ │ └── Altinn.Register.Contracts.csproj
└── apps
│ └── Altinn.Register
│ ├── conf.json
│ ├── test
│ ├── Altinn.Register.Persistence.Tests
│ │ ├── Snapshots
│ │ │ ├── .gitignore
│ │ │ ├── .editorconfig
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(uuid).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(pers.id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(org.id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(user.id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookupOne(user.name).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(uuid).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(pers.id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(user.id).verified.sql
│ │ │ ├── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(org.id).verified.sql
│ │ │ └── PartyQueryTests.VerifyQuerySnapshot_includes=display-name,identifiers_filterBy=lookup(user.name).verified.sql
│ │ ├── Utils
│ │ │ └── EnumMembersDataAttribute.cs
│ │ ├── Altinn.Register.Persistence.Tests.csproj
│ │ └── ModuleInitializer.cs
│ ├── Altinn.Register.Tests
│ │ ├── skd-org.pfx
│ │ ├── ttd-org.pfx
│ │ ├── jwtselfsignedcert.pfx
│ │ ├── appsettings.json
│ │ ├── Utils
│ │ │ ├── AtomicCounter.cs
│ │ │ ├── AtomicBool.cs
│ │ │ └── AsyncEnumerableTestExtensions.cs
│ │ ├── Testdata
│ │ │ ├── 50006237.json
│ │ │ ├── 50004219.json
│ │ │ ├── 50004216.json
│ │ │ ├── 50012347.json
│ │ │ └── 50012345.json
│ │ ├── IntegrationTests
│ │ │ └── Utils
│ │ │ │ └── TestAccessTokenGenerator.cs
│ │ ├── Mocks
│ │ │ ├── AuthorizationClientMock.cs
│ │ │ ├── PublicSigningKeyProviderMock.cs
│ │ │ └── DelegatingHandlerStub.cs
│ │ ├── UnitTests
│ │ │ ├── StringExtensionsTests.cs
│ │ │ ├── ImportJobQueueStatusTests.cs
│ │ │ ├── OpaqueTests.cs
│ │ │ ├── PartyTypesSetTests.cs
│ │ │ ├── EventBaseTests.cs
│ │ │ └── CommandBaseTests.cs
│ │ ├── Jobs
│ │ │ └── JobRegistrationTests.cs
│ │ ├── skd-org.pem
│ │ └── ttd-org.pem
│ ├── Altinn.Register.TestUtils.V2
│ │ ├── AsyncLock.cs
│ │ ├── Http
│ │ │ ├── IFakeRequestBuilder.cs
│ │ │ ├── IFilterFakeRequest.cs
│ │ │ ├── Filters
│ │ │ │ ├── HttpMethodFilter.cs
│ │ │ │ ├── RouteValueFilter.cs
│ │ │ │ └── QueryParamFilter.cs
│ │ │ ├── IFakeRequestFilter.cs
│ │ │ ├── ISetFakeRequestHandler.cs
│ │ │ ├── StreamExtensions.cs
│ │ │ └── IFakeRequestHandler.cs
│ │ ├── IAsyncResource.cs
│ │ ├── AsyncTestBase.cs
│ │ ├── FluentAssertionsExtensions
│ │ │ └── Initializer.cs
│ │ └── Assertions
│ │ │ └── CustomAssertions.cs
│ ├── Altinn.Register.TestUtils.V3
│ │ ├── Database
│ │ │ └── PostgresUserType.cs
│ │ ├── Traits
│ │ │ ├── KnownCategories.cs
│ │ │ ├── IntegrationTestAttribute.cs
│ │ │ └── CategoryAttribute.cs
│ │ ├── TestContextExtensions.cs
│ │ ├── Tracing
│ │ │ └── ActivityDisplayFilterCollection.cs
│ │ ├── TestBase.cs
│ │ └── Altinn.Register.TestUtils.V3.csproj
│ ├── Altinn.Register.IntegrationTests
│ │ ├── Tracing
│ │ │ └── IntegrationTestsActivities.cs
│ │ ├── AssemblyFixtures.cs
│ │ ├── TestServices
│ │ │ ├── TestAccessTokenGenerator.cs
│ │ │ ├── TestPublicSigningKeyProvider.cs
│ │ │ └── TestOpenIdConnectConfigurationManager.cs
│ │ └── Altinn.Register.IntegrationTests.csproj
│ ├── .editorconfig
│ └── Altinn.Register.TestUtils
│ │ └── MassTransit
│ │ └── AsyncElementListExtensions.cs
│ ├── src
│ ├── Altinn.Register.Persistence
│ │ ├── Migration
│ │ │ ├── v0.00-schema
│ │ │ │ ├── 00-schema.sql
│ │ │ │ └── 01-default-privileges.sql
│ │ │ ├── v0.04-external-roles
│ │ │ │ ├── 00-hstore-extension.sql
│ │ │ │ ├── 01-identifier-domain.sql
│ │ │ │ ├── 02-translated-text-domain.sql
│ │ │ │ ├── 03-external-role-definition-table.sql
│ │ │ │ ├── 04-external-role-table.sql
│ │ │ │ └── 05-data-external-roles.sql
│ │ │ ├── v0.06-schema-grant
│ │ │ │ └── 00-schema-grant.sql
│ │ │ ├── v0.17-party-display-name
│ │ │ │ ├── 01-party-display-name.sql
│ │ │ │ └── 00-person-short-name.sql
│ │ │ ├── v0.41-cra-role-source
│ │ │ │ └── 00-new-role-source.sql
│ │ │ ├── v0.15-ffor-role-definition
│ │ │ │ └── 00-data-ffor-role-definition.sql
│ │ │ ├── v0.37-system-user-type
│ │ │ │ ├── 00-system-user-type-enum.sql
│ │ │ │ └── 01-system-user-table.sql
│ │ │ ├── v0.02-party-source-values
│ │ │ │ └── 00-party-source-values.sql
│ │ │ ├── v0.07-addresses
│ │ │ │ ├── 03-drop-old-types.sql
│ │ │ │ └── 00-address-types.sql
│ │ │ ├── v0.08-leases
│ │ │ │ └── 00-lease-table.sql
│ │ │ ├── v0.30-partyid-opt
│ │ │ │ └── 00-partyid-opt.sql
│ │ │ ├── v0.01-party
│ │ │ │ ├── 00-enums.sql
│ │ │ │ ├── 01-identifiers.sql
│ │ │ │ ├── 05-person-table.sql
│ │ │ │ ├── 04-party-source-ref-table.sql
│ │ │ │ ├── 02-address.sql
│ │ │ │ └── 06-organization-table.sql
│ │ │ ├── v0.22-role-assignment-indexes
│ │ │ │ └── 00-role-assignment-indexes.sql
│ │ │ ├── v0.42-guardianship-roles
│ │ │ │ └── 00-identifier.sql
│ │ │ ├── v0.36-import-job-state
│ │ │ │ └── 00-import-job-state-table.sql
│ │ │ ├── v0.13-seq-lock
│ │ │ │ └── 01-party-table.sql
│ │ │ ├── v0.03-party-source-values
│ │ │ │ └── 00-party-source-values.sql
│ │ │ ├── v0.38-deleted-user
│ │ │ │ └── 03-remove-usernames-from-deleted-parties.sql
│ │ │ ├── v0.19-si-user-enum
│ │ │ │ └── 00-party-type-enum.sql
│ │ │ ├── v0.27-import-job-state
│ │ │ │ └── 00-import-job-party-state-table.sql
│ │ │ ├── v0.29-new-partytypes
│ │ │ │ └── 00-party-type.sql
│ │ │ ├── v0.10-role-code
│ │ │ │ └── 00-identifier-domain.sql
│ │ │ ├── v0.18-role-identifiers
│ │ │ │ └── 00-identifier.sql
│ │ │ ├── v0.16-identifier-update
│ │ │ │ └── 00-identifier.sql
│ │ │ ├── v0.09-import-job
│ │ │ │ └── 00-import-job-table.sql
│ │ │ ├── v0.05-party-source-ref-index
│ │ │ │ └── 00-party-source-ref-index.sql
│ │ │ ├── v0.11-lease-done
│ │ │ │ └── 00-lease-table.sql
│ │ │ ├── v0.20-si-user
│ │ │ │ └── 00-type-identifier-check.sql
│ │ │ ├── v0.21-party-constraints
│ │ │ │ └── 00-party-constraints.sql
│ │ │ ├── v0.31-username
│ │ │ │ └── 00-username.sql
│ │ │ └── v0.23-user
│ │ │ │ └── 00-user-table.sql
│ │ ├── PostgreSqlVacuumIndexCleanup.cs
│ │ ├── DbArgTypes
│ │ │ └── ArgUpsertExternalRoleAssignment.cs
│ │ ├── PartyListFilters.cs
│ │ ├── UnitOfWork
│ │ │ └── ISavePoint.cs
│ │ └── AsyncEnumerables
│ │ │ └── IAsyncResourceOwner.cs
│ ├── Altinn.Register.AppHost
│ │ ├── appsettings.Development.json
│ │ ├── appsettings.json
│ │ ├── Properties
│ │ │ └── launchSettings.json
│ │ ├── Altinn.Register.AppHost.csproj
│ │ └── ResourceExtensions.cs
│ ├── Directory.Build.props
│ ├── Altinn.Register.Core
│ │ ├── PartyImport
│ │ │ └── A2
│ │ │ │ ├── A2Change.cs
│ │ │ │ ├── A2PartyChangePage.cs
│ │ │ │ ├── A2UserProfileChangePage.cs
│ │ │ │ ├── A2UserProfileType.cs
│ │ │ │ ├── A2PartyChange.cs
│ │ │ │ ├── A2PartyExternalRoleAssignment.cs
│ │ │ │ └── A2UserProfileChange.cs
│ │ ├── ImportJobs
│ │ │ └── ImportJobProcessingStatus.cs
│ │ ├── Parties
│ │ │ ├── PartySource.cs
│ │ │ ├── UpsertUserRecordResult.cs
│ │ │ ├── IPartyPersistenceCleanupService.cs
│ │ │ ├── Records
│ │ │ │ ├── SystemUserRecordType.cs
│ │ │ │ ├── EnterpriseUserRecord.cs
│ │ │ │ ├── SelfIdentifiedUserRecord.cs
│ │ │ │ ├── MailingAddressRecord.cs
│ │ │ │ ├── SystemUserRecord.cs
│ │ │ │ └── PartyRecordType.cs
│ │ │ └── PartySourceRef.cs
│ │ ├── Utils
│ │ │ ├── IAsyncSideEffectEnumerable.cs
│ │ │ └── EnumerableExtensions.cs
│ │ └── UnitOfWork
│ │ │ ├── UnitOfWorkStatus.cs
│ │ │ ├── IUnitOfWorkServiceFactory.cs
│ │ │ └── IUnitOfWorkParticipantFactory.cs
│ ├── Altinn.Register
│ │ ├── Configuration
│ │ │ ├── PlatformSettings.cs
│ │ │ ├── A2PartyImportSettings.cs
│ │ │ └── GeneralSettings.cs
│ │ ├── appsettings.Staging.json
│ │ ├── ModelBinding
│ │ │ └── ISingleton.cs
│ │ ├── appsettings.Development.json
│ │ ├── PartyImport
│ │ │ ├── A2
│ │ │ │ ├── ImportPartyUserIdJobState.cs
│ │ │ │ ├── ImportA2PartyCommand.cs
│ │ │ │ ├── ImportA2UserIdForPartyCommand.cs
│ │ │ │ └── ImportA2UserProfileCommand.cs
│ │ │ ├── SystemUser
│ │ │ │ ├── ImportSystemUserConsumer.cs
│ │ │ │ └── ImportSystemUserCommand.cs
│ │ │ ├── UpsertPartyCommand.cs
│ │ │ ├── UpsertPartyUserCommand.cs
│ │ │ ├── UpsertUserRecordCommand.cs
│ │ │ └── UpsertPartyTracking.cs
│ │ ├── Models
│ │ │ └── OrgContactPointLookup.cs
│ │ ├── Clients
│ │ │ ├── BridgeOrgContactPointLookup.cs
│ │ │ └── Interfaces
│ │ │ │ ├── IPersonClient.cs
│ │ │ │ └── IAuthorizationClient.cs
│ │ ├── ApiDescriptions
│ │ │ ├── PartyFieldIncludesSchemaFilter.cs
│ │ │ └── PartyComponentOptionSchemaFilter.cs
│ │ ├── Services
│ │ │ ├── Interfaces
│ │ │ │ └── IOrgContactPoint.cs
│ │ │ └── Implementation
│ │ │ │ └── OrgContactPointService.cs
│ │ ├── Conventions
│ │ │ ├── IControllerModelCondition.cs
│ │ │ └── IActionModelCondition.cs
│ │ ├── Mapping
│ │ │ └── PartyMapper.User.cs
│ │ ├── Core
│ │ │ ├── PersonLookupSettings.cs
│ │ │ ├── TooManyFailedLookupsException.cs
│ │ │ └── IPersonLookup.cs
│ │ ├── Properties
│ │ │ └── launchSettings.json
│ │ ├── Controllers
│ │ │ └── ErrorController.cs
│ │ ├── Utils
│ │ │ ├── ContractsMapper.cs
│ │ │ └── HttpReciliencyExtensions.cs
│ │ ├── LeaseNames.cs
│ │ └── JobNames.cs
│ ├── Aspire.Npgsql
│ │ └── Altinn.Authorization.Aspire.Npgsql.csproj
│ ├── ServiceDefaults.MassTransit
│ │ ├── AltinnMassTransitOptions.cs
│ │ ├── AltinnEndpointNameFormatter.cs
│ │ ├── Migration
│ │ │ └── v0.00-base
│ │ │ │ └── 00-schema.sql
│ │ ├── IBusLifetime.cs
│ │ ├── MassTransitTransportHelper.InMemoryTransportHelper.cs
│ │ └── IMassTransitBuilder.cs
│ ├── ServiceDefaults.Jobs
│ │ ├── RecurringJobHostedSettings.cs
│ │ ├── IHasJobName.cs
│ │ ├── IJob.cs
│ │ ├── Job.cs
│ │ ├── IJobCondition.cs
│ │ ├── IJobRegistration.cs
│ │ └── Altinn.Authorization.ServiceDefaults.Jobs.csproj
│ ├── ServiceDefaults.MassTransit.Abstractions
│ │ ├── Altinn.Authorization.ServiceDefaults.MassTransit.Abstractions.csproj
│ │ ├── EventBase.cs
│ │ ├── CommandBase.cs
│ │ └── ICommandSender.cs
│ ├── Altinn.Register.Contracts.MassTransit
│ │ ├── Parties
│ │ │ ├── PartyUpdatedEvent.cs
│ │ │ └── PartyReference.cs
│ │ ├── Altinn.Register.Contracts.MassTransit.csproj
│ │ └── ExternalRoles
│ │ │ ├── ExternalRoleReference.cs
│ │ │ ├── ExternalRoleAssignmentAddedEvent.cs
│ │ │ └── ExternalRoleAssignmentRemovedEvent.cs
│ └── ServiceDefaults.Leases
│ │ ├── Altinn.Authorization.ServiceDefaults.Leases.csproj
│ │ ├── Microsoft.Extensions.DependencyInjection
│ │ └── LeaseServiceCollectionExtensions.cs
│ │ ├── LeaseTicket.cs
│ │ └── LeaseReleaseResult.cs
│ └── Directory.Build.targets
├── .release-please-manifest.json
├── .github
├── containerscan
│ └── allowedlist.yaml
├── scripts
│ ├── get-metadata.mts
│ ├── _yargs.mts
│ ├── package.json
│ ├── publish-to-nuget.mts
│ ├── publish-to-github-packages.mts
│ └── tsconfig.json
├── disabled-workflows
│ └── assign-issues-to-projects.yml
└── workflows
│ └── container-scan.yml
├── renovate.json
├── container-scan.md
├── .vscode
└── settings.json
├── docker-compose.yml
├── release-please-config.json
├── Directory.Build.props
├── Dockerfile
└── .justfile
/src/pkgs/Altinn.Register.Contracts/version.txt:
--------------------------------------------------------------------------------
1 | 1.4.1
2 |
--------------------------------------------------------------------------------
/.release-please-manifest.json:
--------------------------------------------------------------------------------
1 | {"src/pkgs/Altinn.Register.Contracts":"1.4.1"}
2 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "deps": ["pkg:Altinn.Register.Contracts"]
3 | }
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Persistence.Tests/Snapshots/.gitignore:
--------------------------------------------------------------------------------
1 | *.received.*
2 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.00-schema/00-schema.sql:
--------------------------------------------------------------------------------
1 | CREATE SCHEMA IF NOT EXISTS register;
2 |
3 |
--------------------------------------------------------------------------------
/.github/containerscan/allowedlist.yaml:
--------------------------------------------------------------------------------
1 | general:
2 | vulnerabilities:
3 | - CVE-2019-0820
4 | - CVE-2024-12797
5 | - CVE-2024-12797
6 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.04-external-roles/00-hstore-extension.sql:
--------------------------------------------------------------------------------
1 | CREATE EXTENSION hstore;
2 |
3 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/Version.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1.4.1
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.06-schema-grant/00-schema-grant.sql:
--------------------------------------------------------------------------------
1 | -- grant schema
2 | GRANT USAGE ON SCHEMA register TO "${APP-USER}";
3 |
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/skd-org.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/altinn/altinn-register/main/src/apps/Altinn.Register/test/Altinn.Register.Tests/skd-org.pfx
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/ttd-org.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/altinn/altinn-register/main/src/apps/Altinn.Register/test/Altinn.Register.Tests/ttd-org.pfx
--------------------------------------------------------------------------------
/.github/scripts/get-metadata.mts:
--------------------------------------------------------------------------------
1 | import { verticals } from "./_meta.mts";
2 | import { inspect } from "node:util";
3 |
4 | console.log(inspect(verticals, { depth: 10, colors: true }));
5 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.17-party-display-name/01-party-display-name.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE register.party
2 | RENAME COLUMN name TO display_name;
3 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V2/AsyncLock.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils;
2 |
3 | internal sealed class AsyncLock()
4 | : AsyncConcurrencyLimiter(1)
5 | {
6 | }
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/jwtselfsignedcert.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/altinn/altinn-register/main/src/apps/Altinn.Register/test/Altinn.Register.Tests/jwtselfsignedcert.pfx
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": [
4 | "local>Altinn/renovate-config",
5 | "local>Altinn/altinn-authorization-tmp:renovate"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.AppHost/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.41-cra-role-source/00-new-role-source.sql:
--------------------------------------------------------------------------------
1 | ALTER TYPE register.external_role_source ADD VALUE 'cra'; -- Norwegian Civil Rights Authority (Sivilrettsforvaltningen)
2 |
--------------------------------------------------------------------------------
/container-scan.md:
--------------------------------------------------------------------------------
1 | # Status for container scans
2 |
3 | [](https://github.com/Altinn/altinn-register/actions/workflows/container-scan.yml)
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.15-ffor-role-definition/00-data-ffor-role-definition.sql:
--------------------------------------------------------------------------------
1 | UPDATE register.external_role_definition
2 | SET code = 'FFØR'
3 | WHERE "source" = 'ccr' AND identifier = 'ffor';
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.37-system-user-type/00-system-user-type-enum.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.system_user_type
2 | CREATE TYPE register.system_user_type AS ENUM(
3 | 'standard',
4 | 'agent'
5 | );
6 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.02-party-source-values/00-party-source-values.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.party_source
2 | ALTER TYPE register.party_source RENAME VALUE 'folkeregistered' TO 'folkeregisteret';
3 |
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V3/Database/PostgresUserType.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils.Database;
2 |
3 | public enum PostgresUserType
4 | {
5 | Owner,
6 | Migrator,
7 | Seeder,
8 | App,
9 | }
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V3/Traits/KnownCategories.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils.Traits;
2 |
3 | public static class KnownCategories
4 | {
5 | public static string IntegrationTest { get; } = "IntegrationTest";
6 | }
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.AppHost/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning",
6 | "Aspire.Hosting.Dcp": "Warning"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.04-external-roles/01-identifier-domain.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.identifier
2 | CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z][a-z0-9_]{2,28}[a-z0-9]$');
3 |
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.07-addresses/03-drop-old-types.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.address
2 | DROP DOMAIN register.address;
3 |
4 | -- Composite: register._address (private - implementation detail)
5 | DROP TYPE register._address;
6 |
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.08-leases/00-lease-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.lease
2 | CREATE TABLE register.lease(
3 | id text PRIMARY KEY NOT NULL,
4 | token uuid NOT NULL,
5 | expires timestamp with time zone NOT NULL
6 | )
7 | TABLESPACE pg_default;
8 |
9 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | enable
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | true
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Persistence.Tests/Snapshots/.editorconfig:
--------------------------------------------------------------------------------
1 | # Verify settings
2 | [*.{sql}]
3 | charset = "utf-8-bom"
4 | end_of_line = lf
5 | indent_size = unset
6 | indent_style = unset
7 | insert_final_newline = false
8 | tab_width = unset
9 | trim_trailing_whitespace = false
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.37-system-user-type/01-system-user-table.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE register.system_user(
2 | uuid uuid NOT NULL PRIMARY KEY REFERENCES register.party(uuid) ON DELETE CASCADE,
3 | "type" register.system_user_type NOT NULL
4 | )
5 | TABLESPACE pg_default;
6 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/SystemUserTests.MinimalSystemUser.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "system-user",
3 | "partyUuid": "00000000-0000-0000-0000-000000000001",
4 | "versionId": 1,
5 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
6 | }
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.30-partyid-opt/00-partyid-opt.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE register.party
2 | ADD CONSTRAINT party_id_check CHECK ((id IS NULL) <> (party_type IN ('person', 'organization', 'self-identified-user')));
3 |
4 | ALTER TABLE register.party
5 | ALTER COLUMN id DROP NOT NULL;
6 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "GeneralSettings": {
3 | "BridgeApiEndpoint": "https://at24.altinn.cloud/sblbridge/register/api/",
4 | "OpenIdWellKnownEndpoint": "http://localhost:5040/authentication/api/v1/openid/",
5 | "JwtCookieName": "AltinnStudioRuntime"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/UnknownPartyTests.MinimalUnknownParty.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "unknown-party",
3 | "partyUuid": "00000000-0000-0000-0000-000000000001",
4 | "versionId": 1,
5 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
6 | }
7 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/EnterpriseUserTests.MinimalEnterpriseUser.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "enterprise-user",
3 | "partyUuid": "00000000-0000-0000-0000-000000000001",
4 | "versionId": 1,
5 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
6 | }
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.IntegrationTests/Tracing/IntegrationTestsActivities.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace Altinn.Register.IntegrationTests.Tracing;
4 |
5 | internal class IntegrationTestsActivities
6 | {
7 | public static ActivitySource Source { get; } = new("Altinn.Register.IntegrationTests");
8 | }
9 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/PersonTests.MinimalPerson.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "person",
3 | "personIdentifier": "25871999336",
4 | "partyUuid": "00000000-0000-0000-0000-000000000001",
5 | "versionId": 1,
6 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
7 | }
8 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/SelfIdentifiedUserTests.MinimalSelfIdentifiedUser.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "self-identified-user",
3 | "partyUuid": "00000000-0000-0000-0000-000000000001",
4 | "versionId": 1,
5 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
6 | }
7 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "xml.format.preserveSpace": [
3 | "xsl:text",
4 | "xsl:comment",
5 | "xsl:processing-instruction",
6 | "literallayout",
7 | "programlisting",
8 | "screen",
9 | "synopsis",
10 | "pre",
11 | "xd:pre",
12 | "BaseArtifactsPath",
13 | "ArtifactsPath",
14 | "VersionFilePath"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/00-enums.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.party_type
2 | CREATE TYPE register.party_type AS ENUM(
3 | 'person',
4 | 'organization'
5 | );
6 |
7 | -- Enum: register.party_source
8 | CREATE TYPE register.party_source AS ENUM(
9 | 'folkeregistered',
10 | 'enhetsregisteret'
11 | );
12 |
13 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/OrganizationTests.MinimalOrganization.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "partyType": "organization",
3 | "organizationIdentifier": "123456785",
4 | "partyUuid": "00000000-0000-0000-0000-000000000001",
5 | "versionId": 1,
6 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
7 | }
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.IntegrationTests/AssemblyFixtures.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Register.IntegrationTests.Fixtures;
2 | using Altinn.Register.TestUtils.Database;
3 | using Altinn.Register.TestUtils.Traits;
4 |
5 | [assembly: IntegrationTest]
6 | [assembly: AssemblyFixture(typeof(PostgresServerFixture))]
7 | [assembly: AssemblyFixture(typeof(WebApplicationFixture))]
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | v2
5 |
6 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V3/Traits/IntegrationTestAttribute.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils.Traits;
2 |
3 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
4 | public sealed class IntegrationTestAttribute()
5 | : CategoryAttribute(KnownCategories.IntegrationTest)
6 | {
7 | }
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.04-external-roles/02-translated-text-domain.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.translated_text
2 | CREATE DOMAIN register.translated_text AS hstore CONSTRAINT translated_text_contains_en CHECK (value ? 'en') CONSTRAINT translated_text_contains_nb CHECK (value ? 'nb') CONSTRAINT translated_text_contains_nn CHECK (value ? 'nn');
3 |
4 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V2/Http/IFakeRequestBuilder.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils.Http;
2 |
3 | ///
4 | /// Combination of and .
5 | ///
6 | public interface IFakeRequestBuilder
7 | : IFilterFakeRequest
8 | , ISetFakeRequestHandler
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.17-party-display-name/00-person-short-name.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE register.person
2 | ADD COLUMN short_name text;
3 |
4 | UPDATE register.person
5 | SET short_name = party.name
6 | FROM register.party
7 | WHERE person.uuid = party.uuid;
8 |
9 | ALTER TABLE register.person
10 | ALTER COLUMN short_name SET NOT NULL;
11 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/Utils/AtomicCounter.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Tests.Utils;
2 |
3 | internal sealed class AtomicCounter
4 | {
5 | private uint _value = 0;
6 |
7 | public void Increment()
8 | {
9 | Interlocked.Increment(ref _value);
10 | }
11 |
12 | public uint Value
13 | => Volatile.Read(ref _value);
14 | }
15 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/01-identifiers.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.person_identifier
2 | CREATE DOMAIN register.person_identifier AS text CONSTRAINT fmtchk CHECK (value ~ '^[0-9]{11}$');
3 |
4 | -- Domain: register.organization_identifier
5 | CREATE DOMAIN register.organization_identifier AS text CONSTRAINT fmtchk CHECK (value ~ '^[0-9]{9}$');
6 |
7 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.22-role-assignment-indexes/00-role-assignment-indexes.sql:
--------------------------------------------------------------------------------
1 | CREATE INDEX ix_from_party
2 | ON register.external_role_assignment (from_party);
3 |
4 | CREATE INDEX ix_to_party
5 | ON register.external_role_assignment (to_party);
6 |
7 | CREATE INDEX ix_from_party_source
8 | ON register.external_role_assignment (from_party, "source");
9 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/PartyImport/A2/A2Change.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.PartyImport.A2;
2 |
3 | ///
4 | /// Represents a base class for changes in Altinn 2.
5 | ///
6 | public abstract record A2Change
7 | {
8 | ///
9 | /// Gets the id of this change.
10 | ///
11 | public required uint ChangeId { get; init; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.42-guardianship-roles/00-identifier.sql:
--------------------------------------------------------------------------------
1 | ALTER DOMAIN register.identifier
2 | DROP CONSTRAINT identifier_valid;
3 |
4 | ALTER DOMAIN register.identifier
5 | ADD CONSTRAINT identifier_valid CHECK (value ~ '^[a-z][a-z0-9]+(?:-[a-z0-9]+)*$');
6 |
7 | ALTER DOMAIN register.identifier
8 | ADD CONSTRAINT identifier_max_length CHECK (char_length(value) <= 64);
9 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/Configuration/PlatformSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Configuration;
2 |
3 | ///
4 | /// Platform configuration settings
5 | ///
6 | public class PlatformSettings
7 | {
8 | ///
9 | /// Gets or sets the authorization endpoint
10 | ///
11 | public string ApiAuthorizationEndpoint { get; set; } = string.Empty;
12 | }
13 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/SelfIdentifiedUser.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ModelUtils;
2 |
3 | namespace Altinn.Register.Contracts;
4 |
5 | ///
6 | /// Represents a self-identified user party in Altinn Register.
7 | ///
8 | [PolymorphicFieldValueRecord]
9 | public sealed record SelfIdentifiedUser()
10 | : Party(PartyType.SelfIdentifiedUser)
11 | {
12 | }
13 |
--------------------------------------------------------------------------------
/.github/scripts/_yargs.mts:
--------------------------------------------------------------------------------
1 | import _yargs from "yargs";
2 | import { hideBin } from "yargs/helpers";
3 |
4 | const fixArgv = (argv?: string[]) => {
5 | argv ??= process.argv;
6 | argv = hideBin(process.argv);
7 |
8 | if (argv!.length > 0 && argv![0].trim() === "--") {
9 | argv = argv!.slice(1);
10 | }
11 |
12 | return argv;
13 | };
14 |
15 | export const yargs = (argv?: string[]) => _yargs(fixArgv(argv));
16 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.36-import-job-state/00-import-job-state-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.import_job_state
2 | CREATE TABLE register.import_job_state(
3 | job_id text NOT NULL, -- cannot reference import_job.id because import_job is handled in a different transaction
4 | state_type text NOT NULL,
5 | state_value jsonb NOT NULL,
6 | PRIMARY KEY (job_id)
7 | )
8 | TABLESPACE pg_default;
9 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.00-schema/01-default-privileges.sql:
--------------------------------------------------------------------------------
1 | -- grant on tables
2 | ALTER DEFAULT PRIVILEGES FOR USER "${YUNIQL-USER}" IN SCHEMA register GRANT
3 | SELECT
4 | , INSERT, UPDATE, REFERENCES, DELETE, TRUNCATE, TRIGGER ON TABLES TO "${APP-USER}";
5 |
6 | -- grant on sequences
7 | ALTER DEFAULT PRIVILEGES FOR USER "${YUNIQL-USER}" IN SCHEMA register GRANT ALL ON SEQUENCES TO "${APP-USER}";
8 |
9 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Aspire.Npgsql/Altinn.Authorization.Aspire.Npgsql.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 | $(NoWarn);CS1591
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.MassTransit/AltinnMassTransitOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Authorization.ServiceDefaults.MassTransit;
2 |
3 | ///
4 | /// Options for altinn masstransit
5 | ///
6 | public class AltinnMassTransitOptions
7 | {
8 | ///
9 | /// Gets or sets the activity propagation type.
10 | ///
11 | public string ActivityPropagation { get; set; } = "Link";
12 | }
13 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/PartyImport/A2/A2PartyChangePage.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Immutable;
2 |
3 | namespace Altinn.Register.Core.PartyImport.A2;
4 |
5 | ///
6 | /// A page of s.
7 | ///
8 | public sealed class A2PartyChangePage(ImmutableArray parties, uint lastKnownChangeId)
9 | : A2ChangePage(parties, lastKnownChangeId)
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/appsettings.Staging.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "System": "Warning",
7 | "Microsoft.Extensions.ServiceDiscovery": "Debug"
8 | },
9 | "ApplicationInsights": {
10 | "LogLevel": {
11 | "Default": "None",
12 | "Altinn.Register": "Information"
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.13-seq-lock/01-party-table.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION register.update_version_id()
2 | RETURNS TRIGGER AS $BODY$
3 | BEGIN
4 | NEW.version_id = register.tx_nextval('register.party_version_id_seq');
5 | RETURN NEW;
6 | END
7 | $BODY$
8 | LANGUAGE plpgsql;
9 |
10 | ALTER TABLE register.party
11 | ALTER COLUMN version_id SET DEFAULT register.tx_nextval('register.party_version_id_seq');
12 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.03-party-source-values/00-party-source-values.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.party_source
2 | -- ccr - (Norwegian) Central Coordinating Register for Legal Entities - Enhetsregisteret
3 | ALTER TYPE register.party_source RENAME VALUE 'enhetsregisteret' TO 'ccr';
4 |
5 | -- npr - (Norwegian) National Population Register - Folkeregisteret
6 | ALTER TYPE register.party_source RENAME VALUE 'folkeregisteret' TO 'npr';
7 |
8 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.38-deleted-user/03-remove-usernames-from-deleted-parties.sql:
--------------------------------------------------------------------------------
1 | WITH deleted_parties_users_with_usernames AS (
2 | SELECT p."uuid"
3 | FROM register.party p
4 | INNER JOIN register.user u USING ("uuid")
5 | WHERE p.is_deleted AND u.username IS NOT NULL
6 | )
7 | UPDATE register.user u
8 | SET username = NULL
9 | FROM deleted_parties_users_with_usernames dpu
10 | WHERE u."uuid" = dpu."uuid";
11 |
--------------------------------------------------------------------------------
/.github/disabled-workflows/assign-issues-to-projects.yml:
--------------------------------------------------------------------------------
1 | name: Auto Assign to Project
2 |
3 | on:
4 | issues:
5 | types:
6 | - opened
7 |
8 | jobs:
9 | add-to-project:
10 | name: Add issue to Team Platform project
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/add-to-project@main
14 | with:
15 | project-url: https://github.com/orgs/Altinn/projects/75
16 | github-token: ${{ secrets.ASSIGN_PROJECT_TOKEN }}
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/PartyImport/A2/A2UserProfileChangePage.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Immutable;
2 |
3 | namespace Altinn.Register.Core.PartyImport.A2;
4 |
5 | ///
6 | /// A page of s.
7 | ///
8 | public sealed class A2UserProfileChangePage(ImmutableArray profiles, uint lastKnownChangeId)
9 | : A2ChangePage(profiles, lastKnownChangeId)
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.MassTransit/AltinnEndpointNameFormatter.cs:
--------------------------------------------------------------------------------
1 | using MassTransit;
2 |
3 | namespace Altinn.Authorization.ServiceDefaults.MassTransit;
4 |
5 | ///
6 | /// A for altinn services.
7 | ///
8 | internal sealed class AltinnEndpointNameFormatter(AltinnServiceDescriptor descriptor)
9 | : KebabCaseEndpointNameFormatter(prefix: descriptor.Name, includeNamespace: false)
10 | {
11 | }
12 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/ImportJobs/ImportJobProcessingStatus.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.ImportJobs;
2 |
3 | ///
4 | /// Import job processing status, consisting of the highest processed item.
5 | ///
6 | public readonly record struct ImportJobProcessingStatus
7 | {
8 | ///
9 | /// Gets the highest processed item.
10 | ///
11 | public readonly required ulong ProcessedMax { get; init; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.19-si-user-enum/00-party-type-enum.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.party_type
2 | -- CREATE TYPE register.party_type AS ENUM(
3 | -- 'person',
4 | -- 'organization'
5 | -- );
6 |
7 | ALTER TYPE register.party_type ADD VALUE 'self-identified-user';
8 |
9 | -- Enum: register.party_type
10 | -- CREATE TYPE register.party_type AS ENUM(
11 | -- 'person',
12 | -- 'organization',
13 | -- 'self-identified-user'
14 | -- );
15 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.04-external-roles/03-external-role-definition-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.external_role_definition
2 | CREATE TABLE register.external_role_definition(
3 | source register.party_source NOT NULL,
4 | identifier register.identifier NOT NULL,
5 | name register.translated_text NOT NULL,
6 | description register.translated_text NOT NULL,
7 | PRIMARY KEY (source, identifier)
8 | )
9 | TABLESPACE pg_default;
10 |
11 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/ModelBinding/ISingleton.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.ModelBinding;
2 |
3 | ///
4 | /// A contract for creating singleton instances in a type-safe manner. .
5 | ///
6 | internal interface ISingleton
7 | where TSelf : ISingleton
8 | {
9 | ///
10 | /// Gets the singleton instance of the implementing type.
11 | ///
12 | public static abstract TSelf Instance { get; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.Jobs/RecurringJobHostedSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Jobs;
2 |
3 | ///
4 | /// Settings for .
5 | ///
6 | public class RecurringJobHostedSettings
7 | {
8 | ///
9 | /// Gets or sets whether to disable the scheduler entirely. If the scheduler is disabled, only lifecycle jobs will run.
10 | ///
11 | public bool DisableScheduler { get; set; } = false;
12 | }
13 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/05-person-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.person
2 | CREATE TABLE register.person(
3 | uuid uuid PRIMARY KEY NOT NULL REFERENCES register.party(uuid) ON DELETE CASCADE ON UPDATE CASCADE,
4 | first_name text NOT NULL,
5 | middle_name text,
6 | last_name text NOT NULL,
7 | address register.address,
8 | mailing_address register.address,
9 | date_of_birth date,
10 | date_of_death date
11 | )
12 | TABLESPACE pg_default;
13 |
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.Jobs/IHasJobName.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Authorization.ServiceDefaults.Jobs;
2 |
3 | ///
4 | /// Interface used to explicitly set the job name on a job type.
5 | ///
6 | /// Self type.
7 | public interface IHasJobName
8 | where TSelf : IHasJobName
9 | {
10 | ///
11 | /// Gets the name of the job.
12 | ///
13 | public static abstract string JobName { get; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/V1/PartyNamesLookup.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Contracts.V1;
2 |
3 | ///
4 | /// Represents a list of lookup criteria when looking for a Party.
5 | ///
6 | public class PartyNamesLookup
7 | {
8 | ///
9 | /// Gets or sets the list of identifiers for the parties to look for.
10 | ///
11 | [JsonPropertyName("parties")]
12 | public IReadOnlyList? Parties { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/Configuration/A2PartyImportSettings.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 |
3 | using System.ComponentModel.DataAnnotations;
4 |
5 | namespace Altinn.Register.Configuration;
6 |
7 | ///
8 | /// Settings for A2 party import.
9 | ///
10 | public class A2PartyImportSettings
11 | {
12 | ///
13 | /// Gets or sets the (root) bridge api endpoint for A2.
14 | ///
15 | [Required]
16 | public Uri? BridgeApiEndpoint { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.MassTransit.Abstractions/Altinn.Authorization.ServiceDefaults.MassTransit.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 | enable
6 | Altinn.Authorization.ServiceDefaults.MassTransit
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V2/Http/IFilterFakeRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils.Http;
2 |
3 | ///
4 | /// Interface used to add filters to a .
5 | ///
6 | public interface IFilterFakeRequest
7 | {
8 | ///
9 | /// Adds a filter to the .
10 | ///
11 | /// The filter.
12 | void AddFilter(IFakeRequestFilter filter);
13 | }
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/PartySource.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.Parties;
2 |
3 | ///
4 | /// Represents a party source.
5 | ///
6 | public enum PartySource
7 | {
8 | ///
9 | /// The Norwegian Central Coordinating Register for Legal Entities.
10 | ///
11 | CentralCoordinatingRegister,
12 |
13 | ///
14 | /// The Norwegian National Population Register.
15 | ///
16 | NationalPopulationRegister,
17 | }
18 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/V1/PartyNamesLookupResult.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Contracts.V1;
2 |
3 | ///
4 | /// Represents a list of party names for each corresponding identifier
5 | ///
6 | public class PartyNamesLookupResult
7 | {
8 | ///
9 | /// Gets or sets the list of identifiers for the parties to look for.
10 | ///
11 | [JsonPropertyName("partyNames")]
12 | public IReadOnlyList? PartyNames { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/.editorconfig:
--------------------------------------------------------------------------------
1 | # Inherit from parent
2 | root = false
3 |
4 | [*.cs]
5 |
6 | # SA1600: Elements should be documented
7 | dotnet_diagnostic.SA1600.severity = none
8 |
9 | # CA1707: Identifiers should not contain underscores
10 | dotnet_diagnostic.CA1707.severity = none
11 |
12 | # FAA0002: Replace Xunit assertion with Fluent Assertions equivalent
13 | dotnet_diagnostic.FAA0002.severity = none
14 |
15 | # SA1312: Variable names should begin with lower-case letter
16 | dotnet_diagnostic.SA1312.severity = none
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/Utils/AtomicBool.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Tests.Utils;
2 |
3 | internal sealed class AtomicBool(bool initialValue = false)
4 | {
5 | private const byte FALSE = 0;
6 | private const byte TRUE = 1;
7 |
8 | private byte _value = initialValue ? TRUE : FALSE;
9 |
10 | public void Set(bool value)
11 | {
12 | Interlocked.Exchange(ref _value, value ? TRUE : FALSE);
13 | }
14 |
15 | public bool Value
16 | => Volatile.Read(ref _value) == TRUE;
17 | }
18 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.4'
2 |
3 | networks:
4 | altinnplatform_network:
5 | external: false
6 |
7 | services:
8 | altinn_register:
9 | container_name: altinn-register
10 | image: altinnregister:latest
11 | restart: always
12 | networks:
13 | - altinnplatform_network
14 | environment:
15 | - ASPNETCORE_ENVIRONMENT=Development
16 | - ASPNETCORE_URLS=http://+:5020
17 | ports:
18 | - "5020:5020"
19 | build:
20 | context: .
21 | dockerfile: Dockerfile
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/UpsertUserRecordResult.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.Parties;
2 |
3 | ///
4 | /// The result of
5 | ///
6 | public sealed record UpsertUserRecordResult
7 | {
8 | ///
9 | /// Gets or sets a value indicating whether the party was updated.
10 | ///
11 | public required bool PartyUpdated { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.27-import-job-state/00-import-job-party-state-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.import_job_party_state
2 | CREATE TABLE register.import_job_party_state(
3 | job_id text NOT NULL, -- cannot reference import_job.id because import_job is handled in a different transaction
4 | party_uuid uuid NOT NULL REFERENCES register.party (uuid) ON DELETE CASCADE,
5 | state_type text NOT NULL,
6 | state_value jsonb NOT NULL,
7 | PRIMARY KEY (job_id, party_uuid)
8 | )
9 | TABLESPACE pg_default;
10 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/04-party-source-ref-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.party_source_ref
2 | CREATE TABLE register.party_source_ref(
3 | party_uuid uuid NOT NULL REFERENCES register.party(uuid) ON DELETE CASCADE ON UPDATE CASCADE,
4 | source register.party_source NOT NULL,
5 | source_identifier text NOT NULL,
6 | source_created timestamp with time zone,
7 | source_updated timestamp with time zone,
8 | PRIMARY KEY (party_uuid, source, source_identifier)
9 | )
10 | TABLESPACE pg_default;
11 |
12 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/Testdata/50006237.json:
--------------------------------------------------------------------------------
1 | {
2 | "PartyTypeName": 3,
3 | "SSN": "",
4 | "OrgNumber": "",
5 | "Person": null,
6 | "Organization": null,
7 | "PartyId": 50006237,
8 | "PartyUUID": "4fe860c4-bc65-4d2f-a288-f825b460f26b",
9 | "UnitType": null,
10 | "LastChangedInAltinn": "2010-03-02T01:53:44.87+01:00",
11 | "LastChangedInExternalRegister": null,
12 | "Name": "TestSelfIdentifiedUser",
13 | "IsDeleted": false,
14 | "OnlyHierarchyElementWithNoAccess": false,
15 | "ChildParties": null
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "System": "Warning",
7 | "Npgsql.Command": "Warning",
8 | "Polly": "Warning",
9 | "Altinn.Authorization.ServiceDefaults.Npgsql.Yuniql": "Trace",
10 | "Altinn.Register": "Debug"
11 | },
12 | "ApplicationInsights": {
13 | "LogLevel": {
14 | "Default": "None",
15 | "Altinn.Register": "None"
16 | }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/IPartyPersistenceCleanupService.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.Parties;
2 |
3 | ///
4 | /// A service for cleaning up party persistence storage.
5 | ///
6 | public interface IPartyPersistenceCleanupService
7 | {
8 | ///
9 | /// Runs periodic cleanup of party storage.
10 | ///
11 | /// A .
12 | public Task RunPeriodicPartyCleanup(CancellationToken cancellationToken = default);
13 | }
14 |
--------------------------------------------------------------------------------
/release-please-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "bootstrap-sha": "733e1608b17fe9eb9abd0d936ed8dcb0e1073590",
3 | "separate-pull-requests": true,
4 | "pull-request-title-pattern": "release${scope}:${component} ${version}",
5 | "release-type": "simple",
6 | "packages": {
7 | "src/pkgs/Altinn.Register.Contracts": {
8 | "component": "Altinn.Register.Contracts",
9 | "extra-files": [
10 | {
11 | "type": "xml",
12 | "path": "Version.props",
13 | "xpath": "//Project/PropertyGroup/Version"
14 | }
15 | ]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/02-address.sql:
--------------------------------------------------------------------------------
1 | -- Composite: register._address (private - implementation detail)
2 | CREATE TYPE register._address AS (
3 | municipal_number text,
4 | municipal_name text,
5 | street_name text,
6 | house_number text,
7 | house_letter text,
8 | apartment_number text,
9 | postal_code text,
10 | city text
11 | );
12 |
13 | -- Domain: register.address
14 | -- No checks at this time, but create a domain so they can be added later
15 | CREATE DOMAIN register.address AS register._address;
16 |
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.01-party/06-organization-table.sql:
--------------------------------------------------------------------------------
1 | -- Table: register.organization
2 | CREATE TABLE register.organization(
3 | uuid uuid PRIMARY KEY NOT NULL REFERENCES register.party(uuid) ON DELETE CASCADE ON UPDATE CASCADE,
4 | unit_status text,
5 | unit_type text,
6 | telephone_number text,
7 | mobile_number text,
8 | fax_number text,
9 | email_address text,
10 | internet_address text,
11 | mailing_address register.address,
12 | business_address register.address
13 | )
14 | TABLESPACE pg_default;
15 |
16 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.MassTransit/Migration/v0.00-base/00-schema.sql:
--------------------------------------------------------------------------------
1 | -- create schema
2 | CREATE SCHEMA IF NOT EXISTS "${SCHEMA}";
3 |
4 | -- grant schema
5 | GRANT USAGE ON SCHEMA "${SCHEMA}" TO "${APP-USER}";
6 |
7 | -- grant on tables
8 | ALTER DEFAULT PRIVILEGES FOR USER "${YUNIQL-USER}" IN SCHEMA "${SCHEMA}" GRANT
9 | SELECT
10 | , INSERT, UPDATE, REFERENCES, DELETE, TRUNCATE, TRIGGER ON TABLES TO "${APP-USER}";
11 |
12 | -- grant on sequences
13 | ALTER DEFAULT PRIVILEGES FOR USER "${YUNIQL-USER}" IN SCHEMA "${SCHEMA}" GRANT ALL ON SEQUENCES TO "${APP-USER}";
14 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/ModuleInitializer.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | namespace Altinn.Register.Contracts.Tests;
4 |
5 | internal class ModuleInitializer
6 | {
7 | private static int _initialized = 0;
8 |
9 | [ModuleInitializer]
10 | public static void Init()
11 | {
12 | if (Interlocked.Exchange(ref _initialized, 1) == 0)
13 | {
14 | VerifierSettings.UseSplitModeForUniqueDirectory();
15 | UseProjectRelativeDirectory("Snapshots");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/PartyImport/A2/ImportPartyUserIdJobState.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 |
3 | using Altinn.Register.Core.ImportJobs;
4 |
5 | namespace Altinn.Register.PartyImport.A2;
6 |
7 | ///
8 | /// State for the import job that imports user-ids from A2 for parties already imported into A3.
9 | ///
10 | internal class ImportPartyUserIdJobState
11 | : IImportJobState
12 | {
13 | ///
14 | static string IImportJobState.StateType => $"{nameof(ImportPartyUserIdJobState)}@0";
15 | }
16 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/EnterpriseUser.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ModelUtils;
2 |
3 | namespace Altinn.Register.Contracts;
4 |
5 | ///
6 | /// Represents an enterprise user party in Altinn Register.
7 | ///
8 | [PolymorphicFieldValueRecord]
9 | public sealed record EnterpriseUser()
10 | : Party(PartyType.EnterpriseUser)
11 | {
12 | ///
13 | /// Gets the owner of the system user.
14 | ///
15 | [JsonPropertyName("owner")]
16 | public required FieldValue Owner { get; init; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Contracts.MassTransit/Parties/PartyUpdatedEvent.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ServiceDefaults.MassTransit;
2 | using MassTransit;
3 |
4 | namespace Altinn.Register.Contracts.Parties;
5 |
6 | ///
7 | /// An event that is published when a party is updated.
8 | ///
9 | [MessageUrn("event:altinn-register:party-updated")]
10 | public sealed record PartyUpdatedEvent
11 | : EventBase
12 | {
13 | ///
14 | /// Gets the party that was updated.
15 | ///
16 | public required PartyReference Party { get; init; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/Models/OrgContactPointLookup.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Altinn.Register.Models;
5 |
6 | ///
7 | /// A class describing the query model for contact points for organizations
8 | ///
9 | public class OrgContactPointLookup
10 | {
11 | ///
12 | /// Gets or sets the list of organization numbers to lookup contact points for
13 | ///
14 | [JsonPropertyName("organizationNumbers")]
15 | public List OrganizationNumbers { get; set; }
16 | }
17 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/V1/PartyComponentOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Contracts.V1;
2 |
3 | ///
4 | /// Specifies the components that should be included when retrieving party's information.
5 | ///
6 | [Flags]
7 | public enum PartyComponentOptions : uint
8 | {
9 | ///
10 | /// No additional components are included.
11 | ///
12 | None = 0,
13 |
14 | ///
15 | /// Includes the party's first name, middle name, and last name.
16 | ///
17 | NameComponents = 1 << 0,
18 | }
19 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.MassTransit/IBusLifetime.cs:
--------------------------------------------------------------------------------
1 | using MassTransit;
2 |
3 | namespace Altinn.Authorization.ServiceDefaults.MassTransit;
4 |
5 | ///
6 | /// Represents the lifetime of a masstransit bus.
7 | ///
8 | public interface IBusLifetime
9 | {
10 | ///
11 | /// Waits for the bus to be ready.
12 | ///
13 | /// A .
14 | /// Information about the bus.
15 | Task WaitForBus(CancellationToken cancellationToken = default);
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.TestUtils.V2/IAsyncResource.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.TestUtils;
2 |
3 | ///
4 | /// Represents a resource that is created and destroyed asynchronously.
5 | ///
6 | /// The self type.
7 | public interface IAsyncResource
8 | : IAsyncDisposable
9 | where TSelf : IAsyncResource
10 | {
11 | ///
12 | /// Creates a new instance of the resource.
13 | ///
14 | /// The resource.
15 | public abstract static ValueTask New();
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.29-new-partytypes/00-party-type.sql:
--------------------------------------------------------------------------------
1 | -- Enum: register.party_type
2 | -- CREATE TYPE register.party_type AS ENUM(
3 | -- 'person',
4 | -- 'organization',
5 | -- 'self-identified-user'
6 | -- );
7 |
8 | ALTER TYPE register.party_type ADD VALUE 'system-user';
9 | ALTER TYPE register.party_type ADD VALUE 'enterprise-user';
10 |
11 | -- Enum: register.party_type
12 | -- CREATE TYPE register.party_type AS ENUM(
13 | -- 'person',
14 | -- 'organization',
15 | -- 'self-identified-user',
16 | -- 'system-user',
17 | -- 'enterprise-user'
18 | -- );
19 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register/Clients/BridgeOrgContactPointLookup.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text.Json.Serialization;
3 |
4 | namespace Altinn.Register.Models;
5 |
6 | ///
7 | /// A class describing the query model for contact points for organizations
8 | ///
9 | public class BridgeOrgContactPointLookup
10 | {
11 | ///
12 | /// Gets or sets the list of organization numbers to lookup contact points for
13 | ///
14 | [JsonPropertyName("organisationNumbers")]
15 | public List OrganisationNumbers { get; set; }
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/Records/SystemUserRecordType.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Altinn.Register.Core.Parties.Records;
4 |
5 | ///
6 | /// Represents a system user record type.
7 | ///
8 | public enum SystemUserRecordType
9 | {
10 | ///
11 | /// A system user for own use.
12 | ///
13 | [JsonStringEnumMemberName("standard")]
14 | Standard,
15 |
16 | ///
17 | /// A system user for client relations.
18 | ///
19 | [JsonStringEnumMemberName("agent")]
20 | Agent,
21 | }
22 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/Records/EnterpriseUserRecord.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ModelUtils;
2 |
3 | namespace Altinn.Register.Core.Parties.Records;
4 |
5 | ///
6 | /// A database record for an enterprise user.
7 | ///
8 | [PolymorphicFieldValueRecord]
9 | public sealed record EnterpriseUserRecord
10 | : PartyRecord
11 | {
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | public EnterpriseUserRecord()
16 | : base(PartyRecordType.EnterpriseUser)
17 | {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/ExternalRoleAssignmentTests.ExternalRoleAssignment_KnownSource.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "role": {
3 | "source": "ccr",
4 | "identifier": "daglig-leder",
5 | "urn": "urn:altinn:external-role:ccr:daglig-leder"
6 | },
7 | "to": {
8 | "partyUuid": "00000000-0000-0000-0000-000000000002",
9 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000002"
10 | },
11 | "from": {
12 | "partyUuid": "00000000-0000-0000-0000-000000000001",
13 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.10-role-code/00-identifier-domain.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.identifier
2 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z][a-z0-9_]{2,28}[a-z0-9]$');
3 | ALTER DOMAIN register.identifier
4 | DROP CONSTRAINT identifier_valid;
5 |
6 | ALTER DOMAIN register.identifier
7 | ADD CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9_]{0,28}[a-z0-9])?$');
8 |
9 | -- Domain: register.identifier
10 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9_]{0,28}[a-z0-9])?$');
11 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.18-role-identifiers/00-identifier.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.identifier
2 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9-]{0,28}[a-z0-9])?$');
3 | ALTER DOMAIN register.identifier
4 | DROP CONSTRAINT identifier_valid;
5 |
6 | ALTER DOMAIN register.identifier
7 | ADD CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9-]{0,48}[a-z0-9])?$');
8 |
9 | -- Domain: register.identifier
10 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9-]{0,48}[a-z0-9])?$');
11 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/src/Altinn.Register.Contracts/IExternalRoleRef.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ModelUtils;
2 |
3 | namespace Altinn.Register.Contracts;
4 |
5 | ///
6 | /// Represents a reference to an external role.
7 | ///
8 | public interface IExternalRoleRef
9 | {
10 | ///
11 | /// Gets the source of the external role.
12 | ///
13 | public NonExhaustiveEnum Source { get; }
14 |
15 | ///
16 | /// Gets the source-unique identifier of the external role.
17 | ///
18 | public string Identifier { get; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/Migration/v0.16-identifier-update/00-identifier.sql:
--------------------------------------------------------------------------------
1 | -- Domain: register.identifier
2 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9_]{0,28}[a-z0-9])?$');
3 | ALTER DOMAIN register.identifier
4 | DROP CONSTRAINT identifier_valid;
5 |
6 | ALTER DOMAIN register.identifier
7 | ADD CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9-]{0,28}[a-z0-9])?$');
8 |
9 | -- Domain: register.identifier
10 | -- CREATE DOMAIN register.identifier AS text CONSTRAINT identifier_valid CHECK (value ~ '^[a-z]([a-z0-9-]{0,28}[a-z0-9])?$');
11 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/ServiceDefaults.Leases/Altinn.Authorization.ServiceDefaults.Leases.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.IntegrationTests/TestServices/TestAccessTokenGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography.X509Certificates;
2 | using Altinn.Common.AccessTokenClient.Services;
3 |
4 | namespace Altinn.Register.IntegrationTests.TestServices;
5 |
6 | internal class TestAccessTokenGenerator
7 | : IAccessTokenGenerator
8 | {
9 | public string GenerateAccessToken(string issuer, string app)
10 | => $"{issuer}:{app}";
11 |
12 | public string GenerateAccessToken(string issuer, string app, X509Certificate2 certificate)
13 | {
14 | throw new NotImplementedException();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Contracts.MassTransit/Altinn.Register.Contracts.MassTransit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | enable
5 | Altinn.Register.Contracts
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/pkgs/Altinn.Register.Contracts/test/Altinn.Register.Contracts.Tests/Snapshots/ExternalRoleAssignmentTests.ExternalRoleAssignment_UnknownSource.verified.json:
--------------------------------------------------------------------------------
1 | {
2 | "role": {
3 | "source": "new-source",
4 | "identifier": "daglig-leder",
5 | "urn": "urn:altinn:external-role:new-source:daglig-leder"
6 | },
7 | "to": {
8 | "partyUuid": "00000000-0000-0000-0000-000000000002",
9 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000002"
10 | },
11 | "from": {
12 | "partyUuid": "00000000-0000-0000-0000-000000000001",
13 | "urn": "urn:altinn:party:uuid:00000000-0000-0000-0000-000000000001"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/PartyImport/A2/A2UserProfileType.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Core.PartyImport.A2;
2 |
3 | ///
4 | /// Represents the type of a user profile in Altinn 2.
5 | ///
6 | public enum A2UserProfileType
7 | {
8 | ///
9 | /// A person (SSN identified) user.
10 | ///
11 | Person,
12 |
13 | ///
14 | /// An enterprise (org number identified) user.
15 | ///
16 | EnterpriseUser,
17 |
18 | ///
19 | /// A self-identified (username identified) user.
20 | ///
21 | SelfIdentifiedUser,
22 | }
23 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Parties/Records/SelfIdentifiedUserRecord.cs:
--------------------------------------------------------------------------------
1 | using Altinn.Authorization.ModelUtils;
2 |
3 | namespace Altinn.Register.Core.Parties.Records;
4 |
5 | ///
6 | /// A database record for a self-identified user.
7 | ///
8 | [PolymorphicFieldValueRecord]
9 | public sealed record SelfIdentifiedUserRecord
10 | : PartyRecord
11 | {
12 | ///
13 | /// Initializes a new instance of the class.
14 | ///
15 | public SelfIdentifiedUserRecord()
16 | : base(PartyRecordType.SelfIdentifiedUser)
17 | {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Persistence/PostgreSqlVacuumIndexCleanup.cs:
--------------------------------------------------------------------------------
1 | namespace Altinn.Register.Persistence;
2 |
3 | ///
4 | /// Vacuum index cleanup options.
5 | ///
6 | internal enum PostgreSqlVacuumIndexCleanup
7 | : byte
8 | {
9 | ///
10 | /// Vacuum index is disabled.
11 | ///
12 | Off = default,
13 |
14 | ///
15 | /// Vacuum index is enabled based on internal heuristics. This is the default.
16 | ///
17 | Auto = 1,
18 |
19 | ///
20 | /// Vacuum index is always enabled.
21 | ///
22 | On = 2,
23 | }
24 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.IntegrationTests/TestServices/TestPublicSigningKeyProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 | using System.Security.Cryptography.X509Certificates;
3 |
4 | namespace Altinn.Register.IntegrationTests.TestServices;
5 |
6 | internal class TestPublicSigningKeyProvider
7 | : X509CertificateBasedSigningKeyProvider
8 | {
9 | private readonly ConcurrentDictionary _certificates = new();
10 |
11 | protected override Task GetCertificate(string issuer, CancellationToken cancellationToken)
12 | {
13 | throw new NotImplementedException();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/.github/scripts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "scripts",
3 | "version": "0.0.0",
4 | "description": "",
5 | "keywords": [],
6 | "author": "",
7 | "private": true,
8 | "devDependencies": {
9 | "@actions/core": "^1.11.1",
10 | "@octokit/action": "^8.0.0",
11 | "@types/node": "^22.19.0",
12 | "arktype": "^2.1.28",
13 | "chalk": "^5.3.0",
14 | "globby": "^14.0.2",
15 | "slugify": "^1.6.6",
16 | "tsx": "^4.20.3",
17 | "typescript": "^5.6.3",
18 | "ws": "^8.18.0",
19 | "yaml": "^2.7.0",
20 | "yargs": "^18.0.0",
21 | "zod": "^4.0.0",
22 | "zod-validation-error": "^4.0.0",
23 | "zx": "^8.6.1"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Tests/IntegrationTests/Utils/TestAccessTokenGenerator.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 |
3 | using System.Security.Cryptography.X509Certificates;
4 | using Altinn.Common.AccessTokenClient.Services;
5 |
6 | namespace Altinn.Register.Tests.IntegrationTests.Utils;
7 |
8 | internal class TestAccessTokenGenerator
9 | : IAccessTokenGenerator
10 | {
11 | public string GenerateAccessToken(string issuer, string app)
12 | => $"{issuer}:{app}";
13 |
14 | public string GenerateAccessToken(string issuer, string app, X509Certificate2 certificate)
15 | {
16 | throw new NotImplementedException();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/src/Altinn.Register.Core/Utils/IAsyncSideEffectEnumerable.cs:
--------------------------------------------------------------------------------
1 | #nullable enable
2 |
3 | using System.Runtime.CompilerServices;
4 |
5 | namespace Altinn.Register.Core.Utils;
6 |
7 | ///
8 | /// Represents an async enumerable that can be executed just for its side effects.
9 | ///
10 | /// The item type.
11 | public interface IAsyncSideEffectEnumerable
12 | : IAsyncEnumerable
13 | {
14 | /// Gets an awaiter used to await this .
15 | /// An awaiter instance.
16 | TaskAwaiter GetAwaiter();
17 | }
18 |
--------------------------------------------------------------------------------
/src/apps/Altinn.Register/test/Altinn.Register.Persistence.Tests/Utils/EnumMembersDataAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Immutable;
2 | using System.Reflection;
3 | using Xunit.Sdk;
4 |
5 | namespace Altinn.Register.Persistence.Tests.Utils;
6 |
7 | public class EnumMembersDataAttribute
8 | : DataAttribute
9 | where TEnum : struct, Enum
10 | {
11 | private static readonly ImmutableArray _values = [..Enum.GetValues()];
12 |
13 | public override IEnumerable