move firebase config to db for testing
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
9edccb1a9d
commit
00fb77e3da
|
@ -14,6 +14,7 @@ class AuthenticatorMobileStageSerializer(StageSerializer):
|
||||||
fields = StageSerializer.Meta.fields + [
|
fields = StageSerializer.Meta.fields + [
|
||||||
"configure_flow",
|
"configure_flow",
|
||||||
"friendly_name",
|
"friendly_name",
|
||||||
|
"firebase_config",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 4.2.5 on 2023-09-21 15:27
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
(
|
||||||
|
"authentik_stages_authenticator_mobile",
|
||||||
|
"0004_mobiledevice_last_checkin_mobiledevice_state",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="authenticatormobilestage",
|
||||||
|
name="firebase_config",
|
||||||
|
field=models.JSONField(default=dict, help_text="temp"),
|
||||||
|
),
|
||||||
|
]
|
|
@ -43,6 +43,8 @@ def default_token_key():
|
||||||
class AuthenticatorMobileStage(ConfigurableStage, FriendlyNamedStage, Stage):
|
class AuthenticatorMobileStage(ConfigurableStage, FriendlyNamedStage, Stage):
|
||||||
"""Setup Mobile authenticator devices"""
|
"""Setup Mobile authenticator devices"""
|
||||||
|
|
||||||
|
firebase_config = models.JSONField(default=dict, help_text="temp")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def serializer(self) -> type[BaseSerializer]:
|
def serializer(self) -> type[BaseSerializer]:
|
||||||
from authentik.stages.authenticator_mobile.api.stage import (
|
from authentik.stages.authenticator_mobile.api.stage import (
|
||||||
|
@ -125,8 +127,7 @@ class MobileTransaction(ExpiringModel):
|
||||||
|
|
||||||
def send_message(self, request: Optional[HttpRequest], **context):
|
def send_message(self, request: Optional[HttpRequest], **context):
|
||||||
"""Send mobile message"""
|
"""Send mobile message"""
|
||||||
cred = credentials.Certificate("firebase.json")
|
initialize_app(credentials.Certificate(self.device.stage.firebase_config))
|
||||||
initialize_app(cred)
|
|
||||||
branding = DEFAULT_TENANT.branding_title
|
branding = DEFAULT_TENANT.branding_title
|
||||||
domain = ""
|
domain = ""
|
||||||
if request:
|
if request:
|
||||||
|
|
|
@ -6143,6 +6143,12 @@
|
||||||
],
|
],
|
||||||
"minLength": 1,
|
"minLength": 1,
|
||||||
"title": "Friendly name"
|
"title": "Friendly name"
|
||||||
|
},
|
||||||
|
"firebase_config": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": true,
|
||||||
|
"title": "Firebase config",
|
||||||
|
"description": "temp"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": []
|
"required": []
|
||||||
|
|
12
schema.yml
12
schema.yml
|
@ -30424,6 +30424,10 @@ components:
|
||||||
friendly_name:
|
friendly_name:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
|
firebase_config:
|
||||||
|
type: object
|
||||||
|
additionalProperties: {}
|
||||||
|
description: temp
|
||||||
required:
|
required:
|
||||||
- component
|
- component
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
|
@ -30452,6 +30456,10 @@ components:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
minLength: 1
|
minLength: 1
|
||||||
|
firebase_config:
|
||||||
|
type: object
|
||||||
|
additionalProperties: {}
|
||||||
|
description: temp
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
AuthenticatorSMSChallenge:
|
AuthenticatorSMSChallenge:
|
||||||
|
@ -38215,6 +38223,10 @@ components:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
minLength: 1
|
minLength: 1
|
||||||
|
firebase_config:
|
||||||
|
type: object
|
||||||
|
additionalProperties: {}
|
||||||
|
description: temp
|
||||||
PatchedAuthenticatorSMSStageRequest:
|
PatchedAuthenticatorSMSStageRequest:
|
||||||
type: object
|
type: object
|
||||||
description: AuthenticatorSMSStage Serializer
|
description: AuthenticatorSMSStage Serializer
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
openapi: 3.0.3
|
openapi: 3.0.3
|
||||||
info:
|
info:
|
||||||
title: authentik
|
title: authentik
|
||||||
version: 2023.8.2
|
version: 2023.8.3
|
||||||
description: Making authentication simple.
|
description: Making authentication simple.
|
||||||
contact:
|
contact:
|
||||||
email: hello@goauthentik.io
|
email: hello@goauthentik.io
|
||||||
|
|
|
@ -83,6 +83,18 @@ export class AuthenticatorMobileStageForm extends ModelForm<AuthenticatorMobileS
|
||||||
<ak-form-group .expanded=${true}>
|
<ak-form-group .expanded=${true}>
|
||||||
<span slot="header"> ${msg("Stage-specific settings")} </span>
|
<span slot="header"> ${msg("Stage-specific settings")} </span>
|
||||||
<div slot="body" class="pf-c-form">
|
<div slot="body" class="pf-c-form">
|
||||||
|
<ak-form-element-horizontal
|
||||||
|
label=${msg("Firebase config")}
|
||||||
|
?required=${false}
|
||||||
|
name="firebaseConfig"
|
||||||
|
>
|
||||||
|
<ak-codemirror
|
||||||
|
mode="javascript"
|
||||||
|
value="${first(this.instance?.firebaseConfig, {})}"
|
||||||
|
>
|
||||||
|
</ak-codemirror>
|
||||||
|
<p class="pf-c-form__helper-text">${msg("Firebase JSON.")}</p>
|
||||||
|
</ak-form-element-horizontal>
|
||||||
<ak-form-element-horizontal
|
<ak-form-element-horizontal
|
||||||
label=${msg("Configuration flow")}
|
label=${msg("Configuration flow")}
|
||||||
name="configureFlow"
|
name="configureFlow"
|
||||||
|
|
Reference in New Issue