diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..3b35cca9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sunbird-auth.iml b/.idea/sunbird-auth.iml new file mode 100644 index 00000000..d6ebd480 --- /dev/null +++ b/.idea/sunbird-auth.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/keycloak/scripts/pipelines/keycloak-build/Jenkinsfile.dev b/keycloak/scripts/pipelines/keycloak-build/Jenkinsfile.dev deleted file mode 100644 index 636c9edf..00000000 --- a/keycloak/scripts/pipelines/keycloak-build/Jenkinsfile.dev +++ /dev/null @@ -1,29 +0,0 @@ -#!groovy - -node('build-slave') { - - currentBuild.result = "SUCCESS" - - try { - - stage('checkout') - { - sh('rm -rf sunbird-auth') - sh('git clone git@github.com:project-sunbird/sunbird-auth.git -b release-1.14') - } - - stage('Build'){ - sh('ls') - sh('cd sunbird-auth/keycloak/scripts/ansible && ansible-playbook -i inventories/dev keycloak.yml --limit localhost --tags build --vault-password-file /home/ops/vault -vvv') - } - - stage('Archive'){ - sh('cp sunbird-auth/keycloak/scripts/ansible/sunbird_auth_1.0v.zip .') - archiveArtifacts 'sunbird_auth_1.0v.zip' - } - } - catch (err) { - currentBuild.result = "FAILURE" - throw err - } -} diff --git a/keycloak/scripts/pipelines/keycloak-build/JenkinsfileConfig.dev b/keycloak/scripts/pipelines/keycloak-build/JenkinsfileConfig.dev deleted file mode 100644 index 3fd90dc3..00000000 --- a/keycloak/scripts/pipelines/keycloak-build/JenkinsfileConfig.dev +++ /dev/null @@ -1,29 +0,0 @@ -#!groovy - -node('build-slave') { - - currentBuild.result = "SUCCESS" - - try { - - stage('checkout') - { - sh('rm -rf sunbird-auth') - sh('git clone https://github.com/ahghatol/sunbird-auth.git') - } - - stage('Build'){ - sh('ls') - sh('cd sunbird-auth/keycloak/scripts/ansible && ansible-playbook -i inventories/dev keycloak.yml --limit localhost --tags build-config --vault-password-file /home/ops/vault -vvv') - } - - stage('Archive'){ - sh('cp sunbird-auth/keycloak/scripts/ansible/sunbird_auth_1.0v.config.zip .') - archiveArtifacts 'sunbird_auth_1.0v.config.zip' - } - } - catch (err) { - currentBuild.result = "FAILURE" - throw err - } -} diff --git a/keycloak/scripts/pipelines/keycloak-build/deploy.sh b/keycloak/scripts/pipelines/keycloak-build/deploy.sh deleted file mode 100644 index 49fa3949..00000000 --- a/keycloak/scripts/pipelines/keycloak-build/deploy.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Build script -# set -o errexit - -#!/bin/sh -# Build script -# set -o errexit -set -e -e () { - echo $( echo ${1} | jq ".${2}" | sed 's/\"//g') -} -m=$(cat $METADATA_FILE) - -org=$(e "${m}" "org") -name=$(e "${m}" "name") -version=$(e "${m}" "version") - -artifactLabel=${ARTIFACT_LABEL:-bronze} -env=${ENV:-null} - -echo "artifactLabel: ${artifactLabel}" -echo "env: ${env}" -echo "org: ${org}" -echo "name: ${name}" -echo "version: ${version}" -echo "ANSIBLE_PATH: $ANSIBLE_PATH" - \ No newline at end of file diff --git a/keycloak/scripts/pipelines/keycloak-build/installDeps.sh b/keycloak/scripts/pipelines/keycloak-build/installDeps.sh deleted file mode 100644 index 49a927e6..00000000 --- a/keycloak/scripts/pipelines/keycloak-build/installDeps.sh +++ /dev/null @@ -1 +0,0 @@ -apk -v add ansible=2.3.0.0-r1 diff --git a/keycloak/scripts/pipelines/sunbird-auth-build/Jenkinsfile b/keycloak/scripts/pipelines/sunbird-auth-build/Jenkinsfile index 8897c7ad..bc17b9ea 100644 --- a/keycloak/scripts/pipelines/sunbird-auth-build/Jenkinsfile +++ b/keycloak/scripts/pipelines/sunbird-auth-build/Jenkinsfile @@ -29,13 +29,13 @@ node('build-slave') { stage('Build') { sh """ mkdir sunbird_auth_1.0v - wget https://sunbirdpublic.blob.core.windows.net/installation/keycloak-3.2.0.Final.tar.gz - tar -xvf keycloak-3.2.0.Final.tar.gz --strip 1 -C sunbird_auth_1.0v + wget -q https://downloads.jboss.org/keycloak/7.0.1/keycloak-7.0.1.tar.gz + tar -xvf keycloak-7.0.1.tar.gz --strip 1 -C sunbird_auth_1.0v mkdir -p sunbird_auth_1.0v/providers mkdir -p sunbird_auth_1.0v/modules/system/layers/keycloak/org/postgresql/main mkdir -p sunbird_auth_1.0v/themes/sunbird/login wget https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar - mv postgresql-9.4.1212.jar sunbird_auth_1.0v/modules/system/layers/keycloak/org/postgresql/main + mv postgresql-9.4.1212.jar sunbird_auth_1.0v/modules/system/layers/keycloak/org/postgresql/main cd keycloak/sms-provider mvn package cp target/keycloak-email-phone-autthenticator-1.0-SNAPSHOT.jar $WORKSPACE/sunbird_auth_1.0v/providers diff --git a/keycloak/sms-provider/.gitignore b/keycloak/sms-provider/.gitignore new file mode 100644 index 00000000..c5f07caa --- /dev/null +++ b/keycloak/sms-provider/.gitignore @@ -0,0 +1,21 @@ +/target/ +project/project +project/target +target +tmp +.history +dist +/.idea +/*.iml +*.iml +*.log +RUNNING_PID +/out +/.idea_modules +/.classpath +/.project +/.settings +/.target/ +/bin/ +/logs +*.zip \ No newline at end of file diff --git a/keycloak/sms-provider/dependency-reduced-pom.xml b/keycloak/sms-provider/dependency-reduced-pom.xml index d7f9ecd5..d7749aba 100644 --- a/keycloak/sms-provider/dependency-reduced-pom.xml +++ b/keycloak/sms-provider/dependency-reduced-pom.xml @@ -35,7 +35,7 @@ org.keycloak keycloak-core - 3.2.0.Final + 7.0.1 provided @@ -55,25 +55,19 @@ org.keycloak keycloak-server-spi - 3.2.0.Final + 7.0.1 provided org.keycloak keycloak-server-spi-private - 3.2.0.Final - provided - - - org.jboss.logging - jboss-logging - 3.3.1.Final + 7.0.1 provided org.keycloak keycloak-services - 3.2.0.Final + 7.0.1 provided @@ -81,7 +75,11 @@ javax.mail - jboss-servlet-api_3.0_spec + javax.json + org.glassfish + + + jboss-servlet-api_4.0_spec org.jboss.spec.javax.servlet @@ -89,11 +87,7 @@ org.twitter4j - resteasy-jaxrs - org.jboss.resteasy - - - jboss-jaxrs-api_2.0_spec + jboss-jaxrs-api_2.1_spec org.jboss.spec.javax.ws.rs @@ -104,10 +98,18 @@ resteasy-multipart-provider org.jboss.resteasy + + owasp-java-html-sanitizer + com.googlecode.owasp-java-html-sanitizer + javase com.google.zxing + + openshift-restclient-java + com.openshift + bcprov-jdk15on org.bouncycastle @@ -139,12 +141,6 @@ junit 4.12 test - - - hamcrest-core - org.hamcrest - - diff --git a/keycloak/sms-provider/keycloak-email-phone-autthenticator.iml b/keycloak/sms-provider/keycloak-email-phone-autthenticator.iml deleted file mode 100644 index 9063f681..00000000 --- a/keycloak/sms-provider/keycloak-email-phone-autthenticator.iml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/keycloak/sms-provider/pom.xml b/keycloak/sms-provider/pom.xml index 20b65fba..5a62df19 100644 --- a/keycloak/sms-provider/pom.xml +++ b/keycloak/sms-provider/pom.xml @@ -46,32 +46,40 @@ org.keycloak keycloak-core provided - 3.2.0.Final + 7.0.1 + + org.keycloak keycloak-server-spi + 7.0.1 provided - 3.2.0.Final + + org.keycloak keycloak-server-spi-private + 7.0.1 provided - 3.2.0.Final + + org.jboss.logging jboss-logging - provided - 3.3.1.Final + 3.4.1.Final + + org.keycloak keycloak-services + 7.0.1 provided - 3.2.0.Final + org.apache.httpcomponents httpclient @@ -86,7 +94,7 @@ com.google.code.gson gson - 2.3.1 + 2.8.5 junit @@ -114,4 +122,4 @@ - \ No newline at end of file + diff --git a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/AbstractPhoneFormAuthenticator.java b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/AbstractPhoneFormAuthenticator.java old mode 100755 new mode 100644 index 703a7666..6f3b7f13 --- a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/AbstractPhoneFormAuthenticator.java +++ b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/AbstractPhoneFormAuthenticator.java @@ -44,7 +44,7 @@ public boolean validateUserAndPassword(AuthenticationFlowContext context, if (username == null) { context.getEvent().error(Errors.USER_NOT_FOUND); - Response challengeResponse = invalidUser(context); + Response challengeResponse = challenge(context, Messages.INVALID_USER); context.failureChallenge(AuthenticationFlowError.INVALID_USER, challengeResponse); return false; } diff --git a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/PhonePasswordForm.java b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/PhonePasswordForm.java old mode 100755 new mode 100644 diff --git a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/PhonePasswordFormFactory.java b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/login/phone/PhonePasswordFormFactory.java old mode 100755 new mode 100644 diff --git a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticator.java b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticator.java index ad5e61a2..66a7d87b 100644 --- a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticator.java +++ b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticator.java @@ -36,7 +36,7 @@ public class ResetCredentialChooseUserAuthenticator implements Authenticator { private static Logger logger = Logger.getLogger(KeycloakSmsAuthenticator.class); - public static final String PROVIDER_ID = "reset-credentials-choose-user"; + public static final String PROVIDER_ID = "spi-reset-credentials-choose-user"; @Override diff --git a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticatorFactory.java b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticatorFactory.java index eef70c1a..bdfab3bc 100644 --- a/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticatorFactory.java +++ b/keycloak/sms-provider/src/main/java/org/sunbird/keycloak/resetcredential/chooseuser/ResetCredentialChooseUserAuthenticatorFactory.java @@ -20,7 +20,7 @@ public class ResetCredentialChooseUserAuthenticatorFactory implements AuthenticatorFactory, ConfigurableAuthenticatorFactory { - public static final String PROVIDER_ID = "reset-credentials-choose-user"; + public static final String PROVIDER_ID = "spi-reset-credentials-choose-user"; private static Logger logger = Logger.getLogger(ResetCredentialChooseUserAuthenticatorFactory.class); diff --git a/keycloak/sms-provider/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory b/keycloak/sms-provider/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory old mode 100755 new mode 100644