communication: use MAS for internal password logins
This commit is contained in:
parent
0f1f34c52a
commit
554061711c
@ -29,7 +29,7 @@ spec:
|
|||||||
- name: MATRIX_BASE
|
- name: MATRIX_BASE
|
||||||
value: http://othrys-synapse-matrix-synapse:8008
|
value: http://othrys-synapse-matrix-synapse:8008
|
||||||
- name: AUTH_BASE
|
- name: AUTH_BASE
|
||||||
value: http://othrys-synapse-matrix-synapse:8008
|
value: http://matrix-authentication-service:8080
|
||||||
- name: BOT_USER
|
- name: BOT_USER
|
||||||
value: atlasbot
|
value: atlasbot
|
||||||
- name: BOT_PASS
|
- name: BOT_PASS
|
||||||
|
|||||||
@ -19,6 +19,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SYNAPSE_BASE
|
- name: SYNAPSE_BASE
|
||||||
value: http://othrys-synapse-matrix-synapse:8008
|
value: http://othrys-synapse-matrix-synapse:8008
|
||||||
|
- name: AUTH_BASE
|
||||||
|
value: http://matrix-authentication-service:8080
|
||||||
- name: SEEDER_USER
|
- name: SEEDER_USER
|
||||||
value: othrys-seeder
|
value: othrys-seeder
|
||||||
- name: SEEDER_PASS
|
- name: SEEDER_PASS
|
||||||
@ -39,10 +41,11 @@ spec:
|
|||||||
NOUN = ["otter","falcon","comet","ember","grove","harbor","meadow","raven","river","summit"]
|
NOUN = ["otter","falcon","comet","ember","grove","harbor","meadow","raven","river","summit"]
|
||||||
|
|
||||||
BASE = os.environ["SYNAPSE_BASE"]
|
BASE = os.environ["SYNAPSE_BASE"]
|
||||||
|
AUTH_BASE = os.environ.get("AUTH_BASE", BASE)
|
||||||
OTHRYS = "!orejZnVfvbAmwQDYba:live.bstein.dev"
|
OTHRYS = "!orejZnVfvbAmwQDYba:live.bstein.dev"
|
||||||
|
|
||||||
def login(user, password):
|
def login(user, password):
|
||||||
r = requests.post(f"{BASE}/_matrix/client/v3/login", json={
|
r = requests.post(f"{AUTH_BASE}/_matrix/client/v3/login", json={
|
||||||
"type": "m.login.password",
|
"type": "m.login.password",
|
||||||
"identifier": {"type": "m.id.user", "user": user},
|
"identifier": {"type": "m.id.user", "user": user},
|
||||||
"password": password,
|
"password": password,
|
||||||
|
|||||||
@ -22,6 +22,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SYNAPSE_BASE
|
- name: SYNAPSE_BASE
|
||||||
value: http://othrys-synapse-matrix-synapse:8008
|
value: http://othrys-synapse-matrix-synapse:8008
|
||||||
|
- name: AUTH_BASE
|
||||||
|
value: http://matrix-authentication-service:8080
|
||||||
- name: SEEDER_USER
|
- name: SEEDER_USER
|
||||||
value: othrys-seeder
|
value: othrys-seeder
|
||||||
- name: SEEDER_PASS
|
- name: SEEDER_PASS
|
||||||
@ -39,6 +41,7 @@ spec:
|
|||||||
import os, requests, urllib.parse
|
import os, requests, urllib.parse
|
||||||
|
|
||||||
BASE = os.environ["SYNAPSE_BASE"]
|
BASE = os.environ["SYNAPSE_BASE"]
|
||||||
|
AUTH_BASE = os.environ.get("AUTH_BASE", BASE)
|
||||||
ROOM_ALIAS = "#othrys:live.bstein.dev"
|
ROOM_ALIAS = "#othrys:live.bstein.dev"
|
||||||
MESSAGE = (
|
MESSAGE = (
|
||||||
"Invite guests: share https://live.bstein.dev/#/room/#othrys:live.bstein.dev?action=join "
|
"Invite guests: share https://live.bstein.dev/#/room/#othrys:live.bstein.dev?action=join "
|
||||||
@ -48,7 +51,7 @@ spec:
|
|||||||
def auth(token): return {"Authorization": f"Bearer {token}"}
|
def auth(token): return {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
def login(user, password):
|
def login(user, password):
|
||||||
r = requests.post(f"{BASE}/_matrix/client/v3/login", json={
|
r = requests.post(f"{AUTH_BASE}/_matrix/client/v3/login", json={
|
||||||
"type": "m.login.password",
|
"type": "m.login.password",
|
||||||
"identifier": {"type": "m.id.user", "user": user},
|
"identifier": {"type": "m.id.user", "user": user},
|
||||||
"password": password,
|
"password": password,
|
||||||
|
|||||||
@ -20,6 +20,8 @@ spec:
|
|||||||
env:
|
env:
|
||||||
- name: SYNAPSE_BASE
|
- name: SYNAPSE_BASE
|
||||||
value: http://othrys-synapse-matrix-synapse:8008
|
value: http://othrys-synapse-matrix-synapse:8008
|
||||||
|
- name: AUTH_BASE
|
||||||
|
value: http://matrix-authentication-service:8080
|
||||||
- name: SEEDER_USER
|
- name: SEEDER_USER
|
||||||
value: othrys-seeder
|
value: othrys-seeder
|
||||||
- name: SEEDER_PASS
|
- name: SEEDER_PASS
|
||||||
@ -44,9 +46,10 @@ spec:
|
|||||||
import os, requests, urllib.parse
|
import os, requests, urllib.parse
|
||||||
|
|
||||||
BASE = os.environ["SYNAPSE_BASE"]
|
BASE = os.environ["SYNAPSE_BASE"]
|
||||||
|
AUTH_BASE = os.environ.get("AUTH_BASE", BASE)
|
||||||
|
|
||||||
def login(user, password):
|
def login(user, password):
|
||||||
r = requests.post(f"{BASE}/_matrix/client/v3/login", json={
|
r = requests.post(f"{AUTH_BASE}/_matrix/client/v3/login", json={
|
||||||
"type": "m.login.password",
|
"type": "m.login.password",
|
||||||
"identifier": {"type": "m.id.user", "user": user},
|
"identifier": {"type": "m.id.user", "user": user},
|
||||||
"password": password,
|
"password": password,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user