Skip to content

Commit

Permalink
feat: added mail to backend
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Jul 11, 2023
1 parent e03bdb4 commit 9d70627
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 43 deletions.
13 changes: 13 additions & 0 deletions api/outdated/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ def default(default_dev=env.NOTSET, default_prod=env.NOTSET):
# Github API
GITHUB_API_TOKEN = env.str("GITHUB_API_TOKEN")


# mailing
EMAIL_HOST = env.str("EMAIL_HOST", "mail")
EMAIL_PORT = env.int("EMAIL_PORT", 1025)
EMAIL_HOST_USER = env.str("EMAIL_HOST_USER", "noreply@outdated.adfinis.com")
SERVER_EMAIL = env.str("SERVER_EMAIL", EMAIL_HOST_USER)
EMAIL_HOST_PASSWORD = env.str("EMAIL_HOST_PASSWORD", "")
EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", False)
from_name = env.str("MAILING_FROM_NAME", "outdated")
from_mail = env.str("MAILING_FROM_MAIL", "noreply@outdated.adfinis.com")
MAILING = {"from_email": from_mail, "from_name": from_name}
MAILING_SENDER = f"{from_name} <{from_mail}>"

# Syncproject settings
RELEVANT_DEPENDENCIES = [
"django",
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ services:
- outdated.local
keycloak:
env_file: ./.envs/.local/.keycloak

mail:
image: mailhog/mailhog
ports:
- "8025:8025"
109 changes: 66 additions & 43 deletions keycloak/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
"otpPolicyLookAheadWindow" : 1,
"otpPolicyPeriod" : 30,
"otpPolicyCodeReusable" : false,
"otpSupportedApplications" : [ "totpAppGoogleName", "totpAppFreeOTPName", "totpAppMicrosoftAuthenticatorName" ],
"otpSupportedApplications" : [ "totpAppMicrosoftAuthenticatorName", "totpAppFreeOTPName", "totpAppGoogleName" ],
"webAuthnPolicyRpEntityName" : "keycloak",
"webAuthnPolicySignatureAlgorithms" : [ "ES256" ],
"webAuthnPolicyRpId" : "",
Expand Down Expand Up @@ -545,6 +545,8 @@
"enabled" : true,
"totp" : false,
"emailVerified" : false,
"firstName" : "",
"lastName" : "",
"credentials" : [ {
"id" : "b673b7b0-e258-450f-af73-c597aface64b",
"type" : "password",
Expand Down Expand Up @@ -1289,7 +1291,7 @@
"subType" : "anonymous",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "oidc-full-name-mapper", "oidc-address-mapper", "oidc-usermodel-property-mapper", "oidc-usermodel-attribute-mapper", "saml-user-attribute-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-role-list-mapper", "saml-user-property-mapper" ]
"allowed-protocol-mapper-types" : [ "oidc-address-mapper", "saml-user-attribute-mapper", "oidc-full-name-mapper", "saml-role-list-mapper", "oidc-usermodel-property-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper", "oidc-usermodel-attribute-mapper" ]
}
}, {
"id" : "f00b6da7-6e74-4b84-a230-4ad541f9a856",
Expand Down Expand Up @@ -1333,7 +1335,7 @@
"subType" : "authenticated",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "oidc-usermodel-property-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-address-mapper", "saml-role-list-mapper", "oidc-full-name-mapper", "saml-user-attribute-mapper", "oidc-usermodel-attribute-mapper", "saml-user-property-mapper" ]
"allowed-protocol-mapper-types" : [ "oidc-usermodel-attribute-mapper", "oidc-full-name-mapper", "saml-user-attribute-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-property-mapper", "oidc-address-mapper", "saml-role-list-mapper", "saml-user-property-mapper" ]
}
}, {
"id" : "3900fc70-9370-4c50-8ac6-f0820593d590",
Expand Down Expand Up @@ -2010,6 +2012,8 @@
}, {
"id" : "b51a8212-141c-457b-9e28-c6c37e6fbb06",
"realm" : "outdated",
"displayName" : "",
"displayNameHtml" : "",
"notBefore" : 0,
"defaultSignatureAlgorithm" : "RS256",
"revokeRefreshToken" : false,
Expand Down Expand Up @@ -2367,7 +2371,7 @@
"otpPolicyLookAheadWindow" : 1,
"otpPolicyPeriod" : 30,
"otpPolicyCodeReusable" : false,
"otpSupportedApplications" : [ "totpAppGoogleName", "totpAppFreeOTPName", "totpAppMicrosoftAuthenticatorName" ],
"otpSupportedApplications" : [ "totpAppMicrosoftAuthenticatorName", "totpAppFreeOTPName", "totpAppGoogleName" ],
"webAuthnPolicyRpEntityName" : "keycloak",
"webAuthnPolicySignatureAlgorithms" : [ "ES256" ],
"webAuthnPolicyRpId" : "",
Expand Down Expand Up @@ -3196,7 +3200,18 @@
"xXSSProtection" : "1; mode=block",
"strictTransportSecurity" : "max-age=31536000; includeSubDomains"
},
"smtpServer" : { },
"smtpServer" : {
"replyToDisplayName" : "",
"starttls" : "false",
"auth" : "",
"port" : "1025",
"host" : "mail",
"replyTo" : "",
"from" : "noreply@outdated.local",
"fromDisplayName" : "Outdated",
"envelopeFrom" : "",
"ssl" : "false"
},
"loginTheme" : "keycloak",
"accountTheme" : "keycloak",
"adminTheme" : "keycloak.v2",
Expand All @@ -3210,13 +3225,6 @@
"identityProviderMappers" : [ ],
"components" : {
"org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy" : [ {
"id" : "3a1b2eaf-3263-49ff-a8a4-e72335f27b16",
"name" : "Consent Required",
"providerId" : "consent-required",
"subType" : "anonymous",
"subComponents" : { },
"config" : { }
}, {
"id" : "5af2789e-38a7-4e83-97ee-a8d08783a831",
"name" : "Full Scope Disabled",
"providerId" : "scope",
Expand All @@ -3230,16 +3238,7 @@
"subType" : "anonymous",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "oidc-usermodel-property-mapper", "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-attribute-mapper", "saml-role-list-mapper", "saml-user-property-mapper", "oidc-address-mapper", "oidc-usermodel-attribute-mapper" ]
}
}, {
"id" : "c0b675bf-1243-4729-80b1-2490b1128297",
"name" : "Allowed Client Scopes",
"providerId" : "allowed-client-templates",
"subType" : "authenticated",
"subComponents" : { },
"config" : {
"allow-default-scopes" : [ "true" ]
"allowed-protocol-mapper-types" : [ "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper", "oidc-usermodel-attribute-mapper", "saml-role-list-mapper", "oidc-usermodel-property-mapper", "saml-user-attribute-mapper", "oidc-address-mapper", "oidc-full-name-mapper" ]
}
}, {
"id" : "1f201cda-10bb-4712-b7f9-f8bfbcecc499",
Expand All @@ -3251,23 +3250,14 @@
"host-sending-registration-request-must-match" : [ "true" ],
"client-uris-must-match" : [ "true" ]
}
}, {
"id" : "3063e1bc-6207-4031-adfc-81478ecb7607",
"name" : "Allowed Client Scopes",
"providerId" : "allowed-client-templates",
"subType" : "anonymous",
"subComponents" : { },
"config" : {
"allow-default-scopes" : [ "true" ]
}
}, {
"id" : "c15da61a-4ce2-4833-8e30-25ccf6141038",
"name" : "Allowed Protocol Mapper Types",
"providerId" : "allowed-protocol-mappers",
"subType" : "authenticated",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "oidc-usermodel-attribute-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-property-mapper", "saml-user-property-mapper", "saml-user-attribute-mapper", "oidc-address-mapper", "saml-role-list-mapper", "oidc-full-name-mapper" ]
"allowed-protocol-mapper-types" : [ "oidc-full-name-mapper", "saml-role-list-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-property-mapper", "oidc-address-mapper", "saml-user-property-mapper", "saml-user-attribute-mapper", "oidc-usermodel-attribute-mapper" ]
}
}, {
"id" : "63da1840-efb7-47a0-86be-00be250e1c29",
Expand All @@ -3278,19 +3268,39 @@
"config" : {
"max-clients" : [ "200" ]
}
} ],
"org.keycloak.keys.KeyProvider" : [ {
"id" : "6dbe6a66-3f79-46ca-b525-2770b024aff8",
"name" : "hmac-generated",
"providerId" : "hmac-generated",
}, {
"id" : "3a1b2eaf-3263-49ff-a8a4-e72335f27b16",
"name" : "Consent Required",
"providerId" : "consent-required",
"subType" : "anonymous",
"subComponents" : { },
"config" : { }
}, {
"id" : "c0b675bf-1243-4729-80b1-2490b1128297",
"name" : "Allowed Client Scopes",
"providerId" : "allowed-client-templates",
"subType" : "authenticated",
"subComponents" : { },
"config" : {
"kid" : [ "deab2e4b-623a-4deb-baae-816027ae2585" ],
"secret" : [ "y25HnCn0jnKyoNlM6pR9wAb43jRzAGfWXCXisbwR0CbmJHSJztVpMTiLGOK9ClaEFVDf528fEl0zVJBM8e8ciA" ],
"priority" : [ "100" ],
"algorithm" : [ "HS256" ]
"allow-default-scopes" : [ "true" ]
}
}, {
"id" : "3063e1bc-6207-4031-adfc-81478ecb7607",
"name" : "Allowed Client Scopes",
"providerId" : "allowed-client-templates",
"subType" : "anonymous",
"subComponents" : { },
"config" : {
"allow-default-scopes" : [ "true" ]
}
} ],
"org.keycloak.userprofile.UserProfileProvider" : [ {
"id" : "19765073-8e12-45d2-9e4c-1246ac4fd091",
"providerId" : "declarative-user-profile",
"subComponents" : { },
"config" : { }
} ],
"org.keycloak.keys.KeyProvider" : [ {
"id" : "f28d754f-6df4-44ee-a02e-4749e7858547",
"name" : "aes-generated",
"providerId" : "aes-generated",
Expand Down Expand Up @@ -3323,6 +3333,17 @@
"priority" : [ "100" ],
"algorithm" : [ "RSA-OAEP" ]
}
}, {
"id" : "6dbe6a66-3f79-46ca-b525-2770b024aff8",
"name" : "hmac-generated",
"providerId" : "hmac-generated",
"subComponents" : { },
"config" : {
"kid" : [ "deab2e4b-623a-4deb-baae-816027ae2585" ],
"secret" : [ "y25HnCn0jnKyoNlM6pR9wAb43jRzAGfWXCXisbwR0CbmJHSJztVpMTiLGOK9ClaEFVDf528fEl0zVJBM8e8ciA" ],
"priority" : [ "100" ],
"algorithm" : [ "HS256" ]
}
} ]
},
"internationalizationEnabled" : false,
Expand Down Expand Up @@ -3915,8 +3936,8 @@
"attributes" : {
"cibaBackchannelTokenDeliveryMode" : "poll",
"cibaAuthRequestedUserHint" : "login_hint",
"clientOfflineSessionMaxLifespan" : "0",
"oauth2DevicePollingInterval" : "5",
"clientOfflineSessionMaxLifespan" : "0",
"clientSessionIdleTimeout" : "0",
"actionTokenGeneratedByUserLifespan-execute-actions" : "",
"actionTokenGeneratedByUserLifespan-verify-email" : "",
Expand All @@ -3928,7 +3949,9 @@
"oauth2DeviceCodeLifespan" : "600",
"actionTokenGeneratedByUserLifespan-idp-verify-account-via-email" : "",
"parRequestUriLifespan" : "60",
"clientSessionMaxLifespan" : "0"
"clientSessionMaxLifespan" : "0",
"frontendUrl" : "",
"acr.loa.map" : "{}"
},
"keycloakVersion" : "21.1.1",
"userManagedAccessAllowed" : false,
Expand Down

0 comments on commit 9d70627

Please sign in to comment.