Commit Graph

13366 Commits

Author SHA1 Message Date
Jens Langhammer db30a62368
fix enroll
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:03 +01:00
Jens Langhammer 01cebcfcec
only consider non expired tokens
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:03 +01:00
Jens Langhammer e176e11b82
generate device with random name as we need to create them in the database
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:03 +01:00
Jens Langhammer 5adbae40ea
fix lint
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 00fb77e3da
move firebase config to db for testing
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 9edccb1a9d
lazy import firebase
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 25e7fc58b3
fix user settings
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer b91fb7cefb
fix import
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer a8f825545f
set auth_via when using mobile token
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 757d179ae5
add logic for checkin
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 38ae3f272e
have schema in a more general place
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 5cf7726ef2
add mobile only subset schema
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer c55f88d4df
implement more
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer ad5ccf8062
set device name from hostname
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 38e7a7fe59
add transaction states
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer a334d21708
move sending code into mobiletransaction model
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 47cb4603da
start checkin
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer cb6d4f9b27
fix more stuff
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 444ea83653
fix web
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer 0a189ceeb5
fix inheritance
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:02 +01:00
Jens Langhammer bcc92d2c0b
update defaults
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 50df8e4530
strings
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer bb8a70448f
more fixes, start implementing validate
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 154b91cc92
make challenge submit
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 742b946caf
add temporary firebase
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 1be264f1c0
add endpoint to check device status
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer a239084385
fix QR
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 4114c757b9
implement more of the API
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 28e1c08800
change mobile device pk to uuid
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer e99a660a5f
move functions to device
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 91c2348b8e
only cache API schema in prod
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 31f869c2e0
fix stuff
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer ada24a609a
fix context
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer a895157be1
fix lint
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer ccb2d0aaed
cleanup
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:01 +01:00
Jens Langhammer 86b69e83e0
change enrollment to post
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:00 +01:00
Jens Langhammer cb60fc2c7b
use more minimal payload for QR code sake
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:00 +01:00
Jens Langhammer fc5f5ed117
initial scaffold
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2024-01-09 12:28:00 +01:00
dependabot[bot] 9ea41595b7
web: bump follow-redirects from 1.15.2 to 1.15.4 in /web (#8098)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 12:27:31 +01:00
dependabot[bot] 74b4fe5cee
website: bump follow-redirects from 1.15.3 to 1.15.4 in /website (#8099)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 12:27:21 +01:00
dependabot[bot] 1ef654f19b
core: bump golang.org/x/oauth2 from 0.15.0 to 0.16.0 (#8092)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.15.0 to 0.16.0.
- [Commits](https://github.com/golang/oauth2/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:06:14 +01:00
dependabot[bot] f030128686
web: bump the eslint group in /tests/wdio with 2 updates (#8093)
Bumps the eslint group in /tests/wdio with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 6.18.0 to 6.18.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.18.0 to 6.18.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: eslint
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:06:00 +01:00
dependabot[bot] 0fb7d1237f
web: bump the babel group in /web with 1 update (#8094)
Bumps the babel group in /web with 1 update: [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env).


Updates `@babel/preset-env` from 7.23.7 to 7.23.8
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.8/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:05:51 +01:00
dependabot[bot] 2497101c32
web: bump ts-lit-plugin from 2.0.1 to 2.0.2 in /web (#8096)
Bumps [ts-lit-plugin](https://github.com/runem/lit-analyzer) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/runem/lit-analyzer/releases)
- [Changelog](https://github.com/runem/lit-analyzer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/runem/lit-analyzer/commits)

---
updated-dependencies:
- dependency-name: ts-lit-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:05:41 +01:00
dependabot[bot] 9a0feb1c35
web: bump the eslint group in /web with 2 updates (#8095)
Bumps the eslint group in /web with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 6.18.0 to 6.18.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.1/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.18.0 to 6.18.1
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: eslint
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:05:27 +01:00
dependabot[bot] ab411a6a9b
web: bump lit-analyzer from 2.0.2 to 2.0.3 in /web (#8097)
Bumps [lit-analyzer](https://github.com/runem/lit-analyzer) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/runem/lit-analyzer/releases)
- [Changelog](https://github.com/runem/lit-analyzer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/runem/lit-analyzer/commits)

---
updated-dependencies:
- dependency-name: lit-analyzer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 11:05:19 +01:00
Ken Sternberg a2dce3fb63
web: Replace calls to `rootInterface()?.tenant?` with a contextual `this.tenant` object (#7778)
* This commit abstracts access to the object `rootInterface()?.config?` into a single accessor,
`authentikConfig`, that can be mixed into any AKElement object that requires access to it.

Since access to `rootInterface()?.config?` is _universally_ used for a single (and repetitive)
boolean check, a separate accessor has been provided that converts all calls of the form:

``` javascript
rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanImpersonate)
```

into:

``` javascript
this.can(CapabilitiesEnum.CanImpersonate)
```

It does this via a Mixin, `WithCapabilitiesConfig`, which understands that these calls only make
sense in the context of a running, fully configured authentik instance, and that their purpose is to
inform authentik components of a user’s capabilities. The latter is why I don’t feel uncomfortable
turning a function call into a method; we should make it explicit that this is a relationship
between components.

The mixin has a single single field, `[WCC.capabilitiesConfig]`, where its association with the
upper-level configuration is made. If that syntax looks peculiar to you, good! I’ve used an explict
unique symbol as the field name; it is inaccessable an innumerable in the object list. The debugger
shows it only as:

    Symbol(): {
        cacheTimeout: 300
        cacheTimeoutFlows: 300
        cacheTimeoutPolicies: 300
        cacheTimeoutReputation: 300
        capabilities: (5) ['can_save_media', 'can_geo_ip', 'can_impersonate', 'can_debug', 'is_enterprise']
    }

Since you can’t reference it by identity, you can’t write to it. Until every browser supports actual
private fields, this is the best we can do; it does guarantee that field name collisions are
impossible, which is a win.

The mixin takes a second optional boolean; setting this to true will cause any web component using
the mixin to automatically schedule a re-render if the capabilities list changes.

The mixin is also generic; despite the "...into a Lit-Context" in the title, the internals of the
Mixin can be replaced with anything so long as the signature of `.can()` is preserved.

Because this work builds off the work I did to give the Sidebar access to the configuration without
ad-hoc retrieval or prop-drilling, it wasn’t necessary to create a new context for it. That will be
necessary for the following:

TODO:

``` javascript
rootInterface()?.uiConfig;
rootInterface()?.tenant;
me();
```

* This commit abstracts access to the object `rootInterface()?.tenant?` into a single accessor,
`tenant`, that can be mixed into any AKElement object that requires access to it.

Like `WithCapabilitiesConfig` and `WithAuthentikConfig`, this one is named `WithTenantConfig`.

TODO:

``` javascript
rootInterface()?.uiConfig;
me();
```

* web: Added a README with a description of the applications' "mental model," essentially an architectural description.

* web: prettier did a thing

* web: prettier had opinions about the README

* web: Jens requested that subscription be  by default, and it's the right call.

* web: Jens requested that the default subscription state for contexts be , and it's the right call.

* web: prettier having opinions after merging with dependent branch

* web: prettier still having opinions.
2024-01-08 13:03:00 -08:00
Ken Sternberg d555c0db41
web: abstract `rootInterface()?.config?.capabilities.includes()` into `.can()` (#7737)
* This commit abstracts access to the object `rootInterface()?.config?` into a single accessor,
`authentikConfig`, that can be mixed into any AKElement object that requires access to it.

Since access to `rootInterface()?.config?` is _universally_ used for a single (and repetitive)
boolean check, a separate accessor has been provided that converts all calls of the form:

``` javascript
rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanImpersonate)
```

into:

``` javascript
this.can(CapabilitiesEnum.CanImpersonate)
```

It does this via a Mixin, `WithCapabilitiesConfig`, which understands that these calls only make
sense in the context of a running, fully configured authentik instance, and that their purpose is to
inform authentik components of a user’s capabilities. The latter is why I don’t feel uncomfortable
turning a function call into a method; we should make it explicit that this is a relationship
between components.

The mixin has a single single field, `[WCC.capabilitiesConfig]`, where its association with the
upper-level configuration is made. If that syntax looks peculiar to you, good! I’ve used an explict
unique symbol as the field name; it is inaccessable an innumerable in the object list. The debugger
shows it only as:

    Symbol(): {
        cacheTimeout: 300
        cacheTimeoutFlows: 300
        cacheTimeoutPolicies: 300
        cacheTimeoutReputation: 300
        capabilities: (5) ['can_save_media', 'can_geo_ip', 'can_impersonate', 'can_debug', 'is_enterprise']
    }

Since you can’t reference it by identity, you can’t write to it. Until every browser supports actual
private fields, this is the best we can do; it does guarantee that field name collisions are
impossible, which is a win.

The mixin takes a second optional boolean; setting this to true will cause any web component using
the mixin to automatically schedule a re-render if the capabilities list changes.

The mixin is also generic; despite the "...into a Lit-Context" in the title, the internals of the
Mixin can be replaced with anything so long as the signature of `.can()` is preserved.

Because this work builds off the work I did to give the Sidebar access to the configuration without
ad-hoc retrieval or prop-drilling, it wasn’t necessary to create a new context for it. That will be
necessary for the following:

TODO:

``` javascript
rootInterface()?.uiConfig;
rootInterface()?.tenant;
me();
```

* web: Added a README with a description of the applications' "mental model," essentially an architectural description.

* web: prettier had opinions about the README

* web: Jens requested that subscription be  by default, and it's the right call.

* This commit abstracts access to the object `rootInterface()?.config?` into a single accessor,
`authentikConfig`, that can be mixed into any AKElement object that requires access to it.

Since access to `rootInterface()?.config?` is _universally_ used for a single (and repetitive)
boolean check, a separate accessor has been provided that converts all calls of the form:

``` javascript
rootInterface()?.config?.capabilities.includes(CapabilitiesEnum.CanImpersonate)
```

into:

``` javascript
this.can(CapabilitiesEnum.CanImpersonate)
```

It does this via a Mixin, `WithCapabilitiesConfig`, which understands that these calls only make
sense in the context of a running, fully configured authentik instance, and that their purpose is to
inform authentik components of a user’s capabilities. The latter is why I don’t feel uncomfortable
turning a function call into a method; we should make it explicit that this is a relationship
between components.

The mixin has a single single field, `[WCC.capabilitiesConfig]`, where its association with the
upper-level configuration is made. If that syntax looks peculiar to you, good! I’ve used an explict
unique symbol as the field name; it is inaccessable an innumerable in the object list. The debugger
shows it only as:

    Symbol(): {
        cacheTimeout: 300
        cacheTimeoutFlows: 300
        cacheTimeoutPolicies: 300
        cacheTimeoutReputation: 300
        capabilities: (5) ['can_save_media', 'can_geo_ip', 'can_impersonate', 'can_debug', 'is_enterprise']
    }

Since you can’t reference it by identity, you can’t write to it. Until every browser supports actual
private fields, this is the best we can do; it does guarantee that field name collisions are
impossible, which is a win.

The mixin takes a second optional boolean; setting this to true will cause any web component using
the mixin to automatically schedule a re-render if the capabilities list changes.

The mixin is also generic; despite the "...into a Lit-Context" in the title, the internals of the
Mixin can be replaced with anything so long as the signature of `.can()` is preserved.

Because this work builds off the work I did to give the Sidebar access to the configuration without
ad-hoc retrieval or prop-drilling, it wasn’t necessary to create a new context for it. That will be
necessary for the following:

TODO:

``` javascript
rootInterface()?.uiConfig;
rootInterface()?.tenant;
me();
```

* web: Added a README with a description of the applications' "mental model," essentially an architectural description.

* web: prettier had opinions about the README

* web: Jens requested that subscription be  by default, and it's the right call.

* web: adjust RAC to point to the (now independent) Interface.

- Also, removed redundant check.
2024-01-08 10:22:52 -08:00
Ken Sternberg c9dc500a2b
web: update some locale details (#8090)
This commit adds "Polish" and "Korean" to the list of languages recognized by the
web-UI, and updates the XLIFF files to include a few new strings from the RAC
project.
2024-01-08 17:27:09 +00:00
dependabot[bot] 7dff303572
web: bump the eslint group in /web with 2 updates (#8082)
Bumps the eslint group in /web with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@typescript-eslint/eslint-plugin` from 6.17.0 to 6.18.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.17.0 to 6.18.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.18.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: eslint
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 13:14:05 +01:00