feat(connector-superoffice): implement OAuth 2.0 flow and S2S architecture
Completed POC for SuperOffice integration with the following key achievements: - Switched from RSA/SOAP to OAuth 2.0 (Refresh Token Flow) for better compatibility with SOD environment. - Implemented robust token refreshing and caching mechanism in . - Solved 'Wrong Subdomain' issue by enforcing for tenant . - Created for REST API interaction (Search, Create, Update UDFs). - Added helper scripts: , , . - Documented usage and configuration in . - Updated configuration requirements. [2ff88f42]
This commit is contained in:
34
connector-superoffice/generate_keys.py
Normal file
34
connector-superoffice/generate_keys.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
# Generate private key
|
||||
private_key = rsa.generate_private_key(
|
||||
public_exponent=65537,
|
||||
key_size=2048,
|
||||
)
|
||||
|
||||
# Serialize private key to PEM
|
||||
pem_private = private_key.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.PKCS8,
|
||||
encryption_algorithm=serialization.NoEncryption()
|
||||
)
|
||||
|
||||
# Generate public key
|
||||
public_key = private_key.public_key()
|
||||
pem_public = public_key.public_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PublicFormat.SubjectPublicKeyInfo
|
||||
)
|
||||
|
||||
# Save to files
|
||||
with open("private_key.pem", "wb") as f:
|
||||
f.write(pem_private)
|
||||
|
||||
with open("public_key.pem", "wb") as f:
|
||||
f.write(pem_public)
|
||||
|
||||
print("Keys generated successfully!")
|
||||
print(f"Private Key (save to .env as SO_PRIVATE_KEY):\n{pem_private.decode('utf-8')}")
|
||||
print("-" * 20)
|
||||
print(f"Public Key (upload to SuperOffice Dev Portal):\n{pem_public.decode('utf-8')}")
|
||||
Reference in New Issue
Block a user