diff --git a/api-doc/reference/Admin-API.v1.yaml b/api-doc/reference/Admin-API.v1.yaml index 5d4df4d67522a23fd146f9075c1e0593a9f0899e..f57e9c247f68889e983ba4364dd4d1b11110c65a 100644 --- a/api-doc/reference/Admin-API.v1.yaml +++ b/api-doc/reference/Admin-API.v1.yaml @@ -8,7 +8,7 @@ servers: paths: /api/admin/device: get: - summary: User device + summary: Get User device information tags: [] responses: '200': @@ -17,10 +17,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Device' - examples: {} + examples: + example-1: + value: + deviceId: sfl123 + displayName: ThinkpadL30 + certificate: sjhgfdszwythudsiuyfdvsxkiwjhyed operationId: get-api-admin-device - requestBody: - description: '' parameters: - schema: type: string @@ -32,7 +35,7 @@ paths: name: deviceId description: Returns the device detailed information. put: - summary: '' + summary: Update device data operationId: put-api-admin-device responses: '200': @@ -54,7 +57,7 @@ paths: in: query name: deviceName delete: - summary: '' + summary: Delete a device operationId: delete-api-admin-device responses: '200': @@ -74,10 +77,10 @@ paths: type: string in: query name: deviceId - description: Revokes a device. + description: Revoke/Delete a device. /api/admin/devices: get: - summary: User devices + summary: "Get User's list of devices" tags: [] responses: '200': @@ -88,6 +91,15 @@ paths: type: array items: $ref: '#/components/schemas/Device' + examples: + example-1: + value: + - deviceId: sfl123 + displayName: ThinkpadL30 + certificate: sjhgfdszwythudsiuyfdvsxkiwjhyed + - deviceId: sfl1234 + displayName: ThinkpadL304 + certificate: sjhgfdszwyth4udsiuyfdvsxkiwjhyed operationId: get-api-admin-devices parameters: - schema: @@ -97,14 +109,14 @@ paths: description: Get a list of devices for a user. /api/admin/directory/entry: put: - summary: '' + summary: Update user profile operationId: put-api-admin-directory-entry responses: '200': description: OK description: "Update a user's profile." post: - summary: User profile + summary: Create User profile operationId: post-api-admin-directory-entry responses: '200': @@ -118,7 +130,7 @@ paths: in: query name: directory delete: - summary: '' + summary: Delete user profile operationId: delete-api-admin-directory-entry responses: '200': @@ -126,7 +138,7 @@ paths: description: Method might probably never be implemented. /api/admin/user: get: - summary: User profile - User + summary: Get User profile tags: [] responses: '200': @@ -135,6 +147,19 @@ paths: application/json: schema: $ref: '#/components/schemas/UserProfile' + examples: + example-1: + value: + username: lily + firstName: Lilye + lastName: Aldrin + phoneNumber: '5149876554' + phoneNumberExtension: '123' + mobileNumber: '4381230987' + faxNumber: '1239876543' + profilePicture: eowiiewjdkfjrekjdvreqljdlfrlqdmf + email: askiur@sfl.com + organization: SFL operationId: get-api-admin-user description: "Get the user's profile." parameters: @@ -143,7 +168,7 @@ paths: in: query name: username post: - summary: '' + summary: Create internal user operationId: post-api-admin-user responses: '200': @@ -152,9 +177,21 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + examples: + example-1: + value: + username: lily + password: abcs123 + userType: LOCAL + realm: '' + accessLevel: USER + needsPasswordReset: 'false' + ethAddress: '' + ethKey: '' + jamiId: '' description: Create an internal user. delete: - summary: '' + summary: Delete a user operationId: delete-api-admin-user responses: '200': @@ -163,6 +200,12 @@ paths: application/json: schema: $ref: './User-API.v1.yaml#/components/schemas/DeviceRevocationResponse' + examples: + example-1: + value: + success: 'true' + errorDetails: '' + timestamp: '2020-06-01T12:30:01' '500': description: Internal Server Error description: Revoke a user. @@ -172,7 +215,7 @@ paths: in: query name: username put: - summary: '' + summary: Update user data operationId: put-api-admin-user responses: '200': @@ -191,7 +234,7 @@ paths: name: password /api/admin/users: get: - summary: Users Profile + summary: Get Users Profile list tags: [] responses: '200': @@ -202,11 +245,34 @@ paths: type: array items: $ref: '#/components/schemas/UserProfile' + examples: + example-1: + value: + - username: lily + firstName: Lilye + lastName: Aldrin + phoneNumber: '5149876554' + phoneNumberExtension: '123' + mobileNumber: '4381230987' + faxNumber: '1239876543' + profilePicture: eowiiewjdkfjrekjdvreqljdlfrlqdmf + email: askiur@sfl.com + organization: SFL + - username: ErikMar + firstName: Marshall + lastName: Eriksen + phoneNumber: '5149876554' + phoneNumberExtension: '123' + mobileNumber: '4381230987' + faxNumber: '1239876543' + profilePicture: eowiiewjdkfjrekjdvreqljdlfrlqdmf + email: askiur@sfl.com + organization: SFL operationId: get-api-admin-users description: Return a list of users. /api/subscription: get: - summary: Subscription status - License + summary: Get Subscription status tags: [] responses: '200': @@ -215,6 +281,16 @@ paths: application/json: schema: $ref: '#/components/schemas/SubscriptionStatusResponse' + examples: + example-1: + value: + licenseInformation: + type: COMMUNITY + products: [] + activated: true + versions: + Key: '' + FIleDescription: {} headers: Access-Control-Allow-Origin: schema: @@ -223,7 +299,7 @@ paths: operationId: get-api-subscription description: Get the subscription status. post: - summary: '' + summary: Upload License operationId: post-api-subscription responses: '200': @@ -231,7 +307,7 @@ paths: description: 'Upload the license here, which is basically just uploading a base64 representation of the keypair - and store on disk.' /api/update: get: - summary: System Status + summary: Get System Status (current and available versions) tags: [] responses: '200': @@ -240,10 +316,20 @@ paths: application/json: schema: $ref: '#/components/schemas/FullSystemStatusResponse' + examples: + example-1: + value: + localVersions: + Key: '' + FIleDescription: [] + remoteVersions: + Key: '' + FIleDescription: {} + updateAvailable: false operationId: get-api-update description: Return the current version number and the available version number of Jams(for update). post: - summary: '' + summary: Update version operationId: post-api-update responses: '200': @@ -262,6 +348,11 @@ components: certificate: type: string description: "The user's Jami device." + x-examples: + example-1: + deviceId: sfl123 + displayName: ThinkpadL30 + certificate: sjhgfdszwythudsiuyfdvsxkiwjhyed UserProfile: title: UserProfile type: object @@ -287,6 +378,18 @@ components: organization: type: string description: "The user's extended information which is not critical to Jami operations, usually provided by LDAP, Active Directory or other backend." + x-examples: + example-1: + username: lily + firstName: Lilye + lastName: Aldrin + phoneNumber: '5149876554' + phoneNumberExtension: '123' + mobileNumber: '4381230987' + faxNumber: '1239876543' + profilePicture: eowiiewjdkfjrekjdvreqljdlfrlqdmf + email: askiur@sfl.com + organization: SFL User: title: User type: object @@ -316,9 +419,29 @@ components: type: string jamiId: type: string + x-examples: + example-1: + username: lily + password: abcs123 + userType: LOCAL + realm: '' + accessLevel: USER + needsPasswordReset: 'false' + ethAddress: '' + ethKey: '' + jamiId: '' SubscriptionStatusResponse: title: SubscriptionStatusResponse type: object + x-examples: + example-1: + licenseInformation: + type: COMMUNITY + products: [] + activated: true + versions: + Key: '' + FIleDescription: {} properties: licenseInformation: $ref: '#/components/schemas/LicenseInformation' @@ -339,6 +462,7 @@ components: type: array items: type: string + x-examples: {} FullSystemStatusResponse: title: FullSystemStatusResponse type: object @@ -349,3 +473,12 @@ components: type: object updateAvailable: type: boolean + x-examples: + example-1: + localVersions: + Key: '' + FIleDescription: [] + remoteVersions: + Key: '' + FIleDescription: {} + updateAvailable: false diff --git a/api-doc/reference/Install-API.v1.yaml b/api-doc/reference/Install-API.v1.yaml index 0e3c6958d078a65c7456f63f8589cb2c69531580..33464392fd1f1635b75d556ea9e26919c3a409d7 100644 --- a/api-doc/reference/Install-API.v1.yaml +++ b/api-doc/reference/Install-API.v1.yaml @@ -8,7 +8,7 @@ servers: paths: /api/install/auth: post: - summary: '' + summary: Configure Authentication Source for Server operationId: post-api-install-auth responses: '200': @@ -21,7 +21,7 @@ paths: description: Internal Server Error description: 'Configure Server to use selected Authentication Source as authentication backend, save settings in config.json file.' get: - summary: Authentication Source + summary: Get Authentication Source for server operationId: get-api-install-auth responses: '200': @@ -29,7 +29,7 @@ paths: description: "Get server's Authentication Source." /api/install/ca: post: - summary: '' + summary: Save Certificate Authority operationId: post-api-install-ca responses: '200': @@ -38,7 +38,7 @@ paths: description: Internal Server Error description: Save Certificate Authority. get: - summary: Certificate Request + summary: Get Certificate Authority operationId: get-api-install-ca responses: '200': @@ -46,7 +46,7 @@ paths: description: Get Certificate Authority. /api/install/settings: post: - summary: '' + summary: Finish Server installation operationId: post-api-install-settings responses: '200': @@ -55,7 +55,7 @@ paths: description: Internal Server Error description: Finish Server installation. get: - summary: '' + summary: Get Server Settings operationId: get-api-install-settings responses: '200': @@ -63,7 +63,7 @@ paths: description: Get Server Settings. /api/install/start: post: - summary: '' + summary: Authenticate user operationId: post-api-install-start responses: '200': @@ -76,7 +76,7 @@ paths: description: Forbidden description: Authenticate user. get: - summary: '' + summary: Check if user should login or sign-up operationId: get-api-install-start responses: '200': @@ -88,7 +88,7 @@ paths: description: 'true' description: Check if user should login or sign-up. put: - summary: '' + summary: Create administrative user account operationId: put-api-install-start responses: '200': @@ -97,6 +97,8 @@ paths: application/json: schema: $ref: '#/components/schemas/AuthTokenResponse' + examples: + example-1: {} '500': description: Internal Server Error description: Create administrative user account. diff --git a/api-doc/reference/Nameserver-API.v1.yaml b/api-doc/reference/Nameserver-API.v1.yaml index ae9de47f4fb8fb0b9f784282974d308c669fc393..e2ff8733f3479c03d763150759a7b4cf6dd6389a 100644 --- a/api-doc/reference/Nameserver-API.v1.yaml +++ b/api-doc/reference/Nameserver-API.v1.yaml @@ -14,7 +14,7 @@ paths: in: path required: true get: - summary: Address lookup + summary: Get Username from Adress tags: [] responses: '200': @@ -35,7 +35,7 @@ paths: in: path required: true get: - summary: Name lookup + summary: Get Address from username tags: [] responses: '200': diff --git a/api-doc/reference/Security-API.v1.yaml b/api-doc/reference/Security-API.v1.yaml index 0b8d608963b591e75322988f87a5afa3d105081b..b037d04546373eacffdc91026e3276cb95163fd8 100644 --- a/api-doc/reference/Security-API.v1.yaml +++ b/api-doc/reference/Security-API.v1.yaml @@ -32,37 +32,16 @@ paths: type: string in: header name: authorization - /api/auth/contacts: - get: - summary: User contacts - tags: [] - responses: {} - operationId: get-api-auth-contacts - description: "Get User's contacts" - put: - summary: '' - operationId: put-api-auth-contacts - responses: - '200': - description: OK - description: "Update User's contact." - delete: - summary: '' - operationId: delete-api-auth-contacts - responses: - '200': - description: OK - description: "Delete user's contact." /api/auth/ocsp: get: - summary: OCSP + summary: Get OCSP tags: [] responses: {} operationId: get-api-auth-ocsp description: Get OCSP. /api/auth/crl: get: - summary: CRL + summary: Get CRL tags: [] responses: '200': diff --git a/api-doc/reference/User-API.v1.yaml b/api-doc/reference/User-API.v1.yaml index fa5e3f9e44a2b2786629907657ce9c2036052190..3e974734ec0015e87365cd47a75bdf6b3e4be9e7 100644 --- a/api-doc/reference/User-API.v1.yaml +++ b/api-doc/reference/User-API.v1.yaml @@ -7,24 +7,36 @@ servers: paths: /api/auth/contacts: get: - summary: Contacts endpoint + summary: "Get User's list of contacts" tags: [] - responses: {} + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Contact' operationId: get-api-auth-contacts description: "Get User's contacts." put: - summary: '' + summary: "Update a User's contact" operationId: put-api-auth-contacts responses: '200': description: OK + '500': + description: Internal Server Error description: "Update User's contact." delete: - summary: '' + summary: "Delete a user's contact" operationId: delete-api-auth-contacts responses: '200': description: OK + '500': + description: Internal Server Error description: "Delete user's contact." '/api/auth/device/{deviceId}': parameters: @@ -34,7 +46,7 @@ paths: in: path required: true get: - summary: Device operations + summary: Get user specified device tags: [] responses: '200': @@ -46,7 +58,7 @@ paths: operationId: get-api-auth-device-deviceId description: "Get a user's specified device." put: - summary: '' + summary: "Update user's device informations" operationId: put-api-auth-device-deviceId responses: '200': @@ -60,7 +72,7 @@ paths: in: query name: deviceName post: - summary: '' + summary: "Create/Store a user's device" operationId: post-api-auth-device-deviceId responses: '200': @@ -73,7 +85,7 @@ paths: description: Internal Server Error description: Create/Store a device for a user. delete: - summary: '' + summary: "Delete user's device" operationId: delete-api-auth-device-deviceId responses: '200': @@ -159,7 +171,7 @@ paths: description: Search user profiles in directory. /api/auth/user: get: - summary: User endpoint + summary: Read user profile tags: [] responses: '200': @@ -167,7 +179,7 @@ paths: operationId: get-api-auth-user description: "Read user's profile (User can \"read\" his own profile)." put: - summary: '' + summary: Update some user profiles fields if LOCAL authentication source operationId: put-api-auth-user responses: '200': @@ -203,6 +215,11 @@ components: type: string timestamp: type: string + x-examples: + example-1: + success: 'true' + errorDetails: '' + timestamp: '2020-06-01T12:30:01' AuthModuleKey: title: AuthModuleKey type: object @@ -215,6 +232,17 @@ components: - AD - LDAP - LOCAL + Contact: + title: Contact + type: object + description: Contact database object + properties: + owner: + type: string + uri: + type: string + displayName: + type: string securitySchemes: API Key - 1: name: API Key diff --git a/authentication-module/src/main/java/net/jami/jams/authmodule/UserAuthenticationModule.java b/authentication-module/src/main/java/net/jami/jams/authmodule/UserAuthenticationModule.java index 1ea10af3c175075733efd58815a033a7fac426f8..5bb5a067e5c095b1705c2e2ca928122c5f38b812 100644 --- a/authentication-module/src/main/java/net/jami/jams/authmodule/UserAuthenticationModule.java +++ b/authentication-module/src/main/java/net/jami/jams/authmodule/UserAuthenticationModule.java @@ -202,7 +202,7 @@ public class UserAuthenticationModule implements AuthenticationModule { return source.test(); } catch (Exception e){ - log.error("The testing of the source was unsuccessful!"); + log.error("The testing of the source was unsuccessful: " + e.toString()); return false; } } diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000000000000000000000000000000000000..96b22e13f573a4106e1eb7357e3c91de3ad662c0 --- /dev/null +++ b/clean.sh @@ -0,0 +1,5 @@ +rm -rf jams +rm derby.log +rm oauth.key +rm oauth.pub + diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateAuthSourceServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateAuthSourceServlet.java index 0de31e2f485451488858f4d3cde1b1c07c72d4cb..d063766068bd6da27ac02c0fcf5f0b195167e91a 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateAuthSourceServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateAuthSourceServlet.java @@ -29,6 +29,7 @@ import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; import net.jami.jams.common.authentication.AuthenticationSourceType; import net.jami.jams.common.objects.requests.CreateAuthSourceRequest; @@ -37,6 +38,7 @@ import java.io.IOException; import static net.jami.jams.server.Server.userAuthenticationModule; @WebServlet("/api/install/auth") +@Slf4j public class CreateAuthSourceServlet extends HttpServlet { @Override diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java index 099b4d33060512a6422c7a7f3e6ccd92caa7a4da..fe253da6a1ab512401f5a8b31ff247fc35854c1e 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/InstallLastStepServlet.java @@ -35,22 +35,11 @@ import java.util.HashMap; @WebServlet("/api/install/lastStep") public class InstallLastStepServlet extends HttpServlet { - private static volatile String lastURI = "/api/jumpstart/setupCA"; - - public static String getLastURI() { - return lastURI; - } - - public static void setLastURI(String lastURI) { - InstallLastStepServlet.lastURI = lastURI; - } - @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Access-Control-Allow-Origin", JamsCA.serverDomain); HashMap<String,String> payload = new HashMap<>(); payload.put("uri",CachedObjects.endpoint); - resp.setStatus(200); resp.getOutputStream().write(JsonStream.serialize(resp).getBytes()); } } diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java index fe4fc9a22f240d28d1903f9014e53d3a168f02a6..a3de6eee0d1ae8dcbb287652af5f31cd23c2892a 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/StartInstallServlet.java @@ -90,8 +90,7 @@ public class StartInstallServlet extends HttpServlet { user.setAccessLevel(AccessLevel.ADMIN); dataStore.getUserDao().storeObject(user); AuthTokenResponse res = processUsernamePasswordAuth(user.getUsername(),user.getPassword()); - resp.getOutputStream().write(JsonStream.serialize(res).getBytes()); - resp.setStatus(200); CachedObjects.endpoint = "/api/install/ca"; + resp.getOutputStream().write(JsonStream.serialize(res).getBytes()); } } diff --git a/jams-server/src/main/resources/webapp/css/countrySelect.css b/jams-server/src/main/resources/webapp/css/countrySelect.css new file mode 100644 index 0000000000000000000000000000000000000000..36d77af226c0c1bb79c76ab1d50f2a0136fa6aaa --- /dev/null +++ b/jams-server/src/main/resources/webapp/css/countrySelect.css @@ -0,0 +1,1205 @@ +.country-select{ + position:relative; + display:inline-block +} +.country-select *{ + -webkit-box-sizing:border-box; + box-sizing:border-box +} +.country-select .hide{ + display:none +} +.country-select .v-hide{ + visibility:hidden +} +.country-select input, +.country-select input[type=text]{ + position:relative; + z-index:0; + margin-top:0 !important; + margin-bottom:0 !important; + padding-right:36px; + margin-right:0 +} +.country-select .flag-dropdown{ + position:absolute; + top:0; + bottom:0; + right:0; + padding:1px +} +.country-select .selected-flag{ + z-index:1; + position:relative; + width:36px; + height:100%; + padding:0 0 0 8px +} +.country-select .selected-flag .flag{ + position:absolute; + top:0; + bottom:0; + margin:auto +} +.country-select .selected-flag .arrow{ + position:absolute; + top:50%; + margin-top:-2px; + right:6px; + width:0; + height:0; + border-left:3px solid transparent; + border-right:3px solid transparent; + border-top:4px solid #555 +} +.country-select .selected-flag .arrow.up{ + border-top:none; + border-bottom:4px solid #555 +} +.country-select .country-list{ + position:absolute; + z-index:2; + list-style:none; + text-align:left; + padding:0; + margin:0 0 0 -1px; + -webkit-box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); + box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); + background-color:white; + border:1px solid #ccc; + white-space:nowrap; + max-height:200px; + overflow-y:scroll +} +.country-select .country-list .flag{ + display:inline-block; + width:20px +} +@media (max-width: 500px){ + .country-select .country-list{ + white-space:normal + } +} +.country-select .country-list .divider{ + padding-bottom:5px; + margin-bottom:5px; + border-bottom:1px solid #ccc +} +.country-select .country-list .country{ + padding:5px 10px +} +.country-select .country-list .country.highlight{ + background-color:rgba(0, 0, 0, 0.05) +} +.country-select .country-list .flag, +.country-select .country-list .country-name{ + vertical-align:middle +} +.country-select .country-list .flag{ + margin-right:6px +} +.country-select.inside input, +.country-select.inside input[type=text]{ + padding-right:6px; + padding-left:52px; + margin-left:0 +} +.country-select.inside .flag-dropdown{ + right:auto; + left:0 +} +.country-select.inside .selected-flag{ + width:46px +} +.country-select.inside .flag-dropdown:hover{ + cursor:pointer +} +.country-select.inside .flag-dropdown:hover .selected-flag{ + background-color:rgba(0, 0, 0, 0.05) +} +.country-select.inside input[disabled] + .flag-dropdown:hover, +.country-select.inside input[readonly] + .flag-dropdown:hover{ + cursor:default +} +.country-select.inside input[disabled] + .flag-dropdown:hover .selected-flag, +.country-select.inside input[readonly] + .flag-dropdown:hover .selected-flag{ + background-color:transparent +} +.country-select .flag{ + width:20px; + height:15px; + -webkit-box-shadow:0px 0px 1px 0px #888; + box-shadow:0px 0px 1px 0px #888; + background-image:url("../images/flags.png"); + background-repeat:no-repeat; + background-color:#dbdbdb; + background-position:20px 0 +} +@media only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and (min--moz-device-pixel-ratio: 2), +only screen and (min-device-pixel-ratio: 2), +only screen and (min-resolution: 192dpi), +only screen and (min-resolution: 2dppx){ + .country-select .flag{ + background-image:url("../images/flags@2x.png") + } +} +.country-select .flag{ + width:20px +} +.country-select .flag.be{ + width:18px +} +.country-select .flag.ch{ + width:15px +} +.country-select .flag.mc{ + width:19px +} +.country-select .flag.ne{ + width:18px +} +.country-select .flag.np{ + width:13px +} +.country-select .flag.va{ + width:15px +} +@media only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and (min--moz-device-pixel-ratio: 2), +only screen and (min-device-pixel-ratio: 2), +only screen and (min-resolution: 192dpi), +only screen and (min-resolution: 2dppx){ + .country-select .flag{ + background-size:5630px 15px + } +} +.country-select .flag.ac{ + height:10px; + background-position:0px 0px +} +.country-select .flag.ad{ + height:14px; + background-position:-22px 0px +} +.country-select .flag.ae{ + height:10px; + background-position:-44px 0px +} +.country-select .flag.af{ + height:14px; + background-position:-66px 0px +} +.country-select .flag.ag{ + height:14px; + background-position:-88px 0px +} +.country-select .flag.ai{ + height:10px; + background-position:-110px 0px +} +.country-select .flag.al{ + height:15px; + background-position:-132px 0px +} +.country-select .flag.am{ + height:10px; + background-position:-154px 0px +} +.country-select .flag.ao{ + height:14px; + background-position:-176px 0px +} +.country-select .flag.aq{ + height:14px; + background-position:-198px 0px +} +.country-select .flag.ar{ + height:13px; + background-position:-220px 0px +} +.country-select .flag.as{ + height:10px; + background-position:-242px 0px +} +.country-select .flag.at{ + height:14px; + background-position:-264px 0px +} +.country-select .flag.au{ + height:10px; + background-position:-286px 0px +} +.country-select .flag.aw{ + height:14px; + background-position:-308px 0px +} +.country-select .flag.ax{ + height:13px; + background-position:-330px 0px +} +.country-select .flag.az{ + height:10px; + background-position:-352px 0px +} +.country-select .flag.ba{ + height:10px; + background-position:-374px 0px +} +.country-select .flag.bb{ + height:14px; + background-position:-396px 0px +} +.country-select .flag.bd{ + height:12px; + background-position:-418px 0px +} +.country-select .flag.be{ + height:15px; + background-position:-440px 0px +} +.country-select .flag.bf{ + height:14px; + background-position:-460px 0px +} +.country-select .flag.bg{ + height:12px; + background-position:-482px 0px +} +.country-select .flag.bh{ + height:12px; + background-position:-504px 0px +} +.country-select .flag.bi{ + height:12px; + background-position:-526px 0px +} +.country-select .flag.bj{ + height:14px; + background-position:-548px 0px +} +.country-select .flag.bl{ + height:14px; + background-position:-570px 0px +} +.country-select .flag.bm{ + height:10px; + background-position:-592px 0px +} +.country-select .flag.bn{ + height:10px; + background-position:-614px 0px +} +.country-select .flag.bo{ + height:14px; + background-position:-636px 0px +} +.country-select .flag.bq{ + height:14px; + background-position:-658px 0px +} +.country-select .flag.br{ + height:14px; + background-position:-680px 0px +} +.country-select .flag.bs{ + height:10px; + background-position:-702px 0px +} +.country-select .flag.bt{ + height:14px; + background-position:-724px 0px +} +.country-select .flag.bv{ + height:15px; + background-position:-746px 0px +} +.country-select .flag.bw{ + height:14px; + background-position:-768px 0px +} +.country-select .flag.by{ + height:10px; + background-position:-790px 0px +} +.country-select .flag.bz{ + height:14px; + background-position:-812px 0px +} +.country-select .flag.ca{ + height:10px; + background-position:-834px 0px +} +.country-select .flag.cc{ + height:10px; + background-position:-856px 0px +} +.country-select .flag.cd{ + height:15px; + background-position:-878px 0px +} +.country-select .flag.cf{ + height:14px; + background-position:-900px 0px +} +.country-select .flag.cg{ + height:14px; + background-position:-922px 0px +} +.country-select .flag.ch{ + height:15px; + background-position:-944px 0px +} +.country-select .flag.ci{ + height:14px; + background-position:-961px 0px +} +.country-select .flag.ck{ + height:10px; + background-position:-983px 0px +} +.country-select .flag.cl{ + height:14px; + background-position:-1005px 0px +} +.country-select .flag.cm{ + height:14px; + background-position:-1027px 0px +} +.country-select .flag.cn{ + height:14px; + background-position:-1049px 0px +} +.country-select .flag.co{ + height:14px; + background-position:-1071px 0px +} +.country-select .flag.cp{ + height:14px; + background-position:-1093px 0px +} +.country-select .flag.cr{ + height:12px; + background-position:-1115px 0px +} +.country-select .flag.cu{ + height:10px; + background-position:-1137px 0px +} +.country-select .flag.cv{ + height:12px; + background-position:-1159px 0px +} +.country-select .flag.cw{ + height:14px; + background-position:-1181px 0px +} +.country-select .flag.cx{ + height:10px; + background-position:-1203px 0px +} +.country-select .flag.cy{ + height:13px; + background-position:-1225px 0px +} +.country-select .flag.cz{ + height:14px; + background-position:-1247px 0px +} +.country-select .flag.de{ + height:12px; + background-position:-1269px 0px +} +.country-select .flag.dg{ + height:10px; + background-position:-1291px 0px +} +.country-select .flag.dj{ + height:14px; + background-position:-1313px 0px +} +.country-select .flag.dk{ + height:15px; + background-position:-1335px 0px +} +.country-select .flag.dm{ + height:10px; + background-position:-1357px 0px +} +.country-select .flag.do{ + height:13px; + background-position:-1379px 0px +} +.country-select .flag.dz{ + height:14px; + background-position:-1401px 0px +} +.country-select .flag.ea{ + height:14px; + background-position:-1423px 0px +} +.country-select .flag.ec{ + height:14px; + background-position:-1445px 0px +} +.country-select .flag.ee{ + height:13px; + background-position:-1467px 0px +} +.country-select .flag.eg{ + height:14px; + background-position:-1489px 0px +} +.country-select .flag.eh{ + height:10px; + background-position:-1511px 0px +} +.country-select .flag.er{ + height:10px; + background-position:-1533px 0px +} +.country-select .flag.es{ + height:14px; + background-position:-1555px 0px +} +.country-select .flag.et{ + height:10px; + background-position:-1577px 0px +} +.country-select .flag.eu{ + height:14px; + background-position:-1599px 0px +} +.country-select .flag.fi{ + height:12px; + background-position:-1621px 0px +} +.country-select .flag.fj{ + height:10px; + background-position:-1643px 0px +} +.country-select .flag.fk{ + height:10px; + background-position:-1665px 0px +} +.country-select .flag.fm{ + height:11px; + background-position:-1687px 0px +} +.country-select .flag.fo{ + height:15px; + background-position:-1709px 0px +} +.country-select .flag.fr{ + height:14px; + background-position:-1731px 0px +} +.country-select .flag.ga{ + height:15px; + background-position:-1753px 0px +} +.country-select .flag.gb{ + height:10px; + background-position:-1775px 0px +} +.country-select .flag.gd{ + height:12px; + background-position:-1797px 0px +} +.country-select .flag.ge{ + height:14px; + background-position:-1819px 0px +} +.country-select .flag.gf{ + height:14px; + background-position:-1841px 0px +} +.country-select .flag.gg{ + height:14px; + background-position:-1863px 0px +} +.country-select .flag.gh{ + height:14px; + background-position:-1885px 0px +} +.country-select .flag.gi{ + height:10px; + background-position:-1907px 0px +} +.country-select .flag.gl{ + height:14px; + background-position:-1929px 0px +} +.country-select .flag.gm{ + height:14px; + background-position:-1951px 0px +} +.country-select .flag.gn{ + height:14px; + background-position:-1973px 0px +} +.country-select .flag.gp{ + height:14px; + background-position:-1995px 0px +} +.country-select .flag.gq{ + height:14px; + background-position:-2017px 0px +} +.country-select .flag.gr{ + height:14px; + background-position:-2039px 0px +} +.country-select .flag.gs{ + height:10px; + background-position:-2061px 0px +} +.country-select .flag.gt{ + height:13px; + background-position:-2083px 0px +} +.country-select .flag.gu{ + height:11px; + background-position:-2105px 0px +} +.country-select .flag.gw{ + height:10px; + background-position:-2127px 0px +} +.country-select .flag.gy{ + height:12px; + background-position:-2149px 0px +} +.country-select .flag.hk{ + height:14px; + background-position:-2171px 0px +} +.country-select .flag.hm{ + height:10px; + background-position:-2193px 0px +} +.country-select .flag.hn{ + height:10px; + background-position:-2215px 0px +} +.country-select .flag.hr{ + height:10px; + background-position:-2237px 0px +} +.country-select .flag.ht{ + height:12px; + background-position:-2259px 0px +} +.country-select .flag.hu{ + height:10px; + background-position:-2281px 0px +} +.country-select .flag.ic{ + height:14px; + background-position:-2303px 0px +} +.country-select .flag.id{ + height:14px; + background-position:-2325px 0px +} +.country-select .flag.ie{ + height:10px; + background-position:-2347px 0px +} +.country-select .flag.il{ + height:15px; + background-position:-2369px 0px +} +.country-select .flag.im{ + height:10px; + background-position:-2391px 0px +} +.country-select .flag.in{ + height:14px; + background-position:-2413px 0px +} +.country-select .flag.io{ + height:10px; + background-position:-2435px 0px +} +.country-select .flag.iq{ + height:14px; + background-position:-2457px 0px +} +.country-select .flag.ir{ + height:12px; + background-position:-2479px 0px +} +.country-select .flag.is{ + height:15px; + background-position:-2501px 0px +} +.country-select .flag.it{ + height:14px; + background-position:-2523px 0px +} +.country-select .flag.je{ + height:12px; + background-position:-2545px 0px +} +.country-select .flag.jm{ + height:10px; + background-position:-2567px 0px +} +.country-select .flag.jo{ + height:10px; + background-position:-2589px 0px +} +.country-select .flag.jp{ + height:14px; + background-position:-2611px 0px +} +.country-select .flag.ke{ + height:14px; + background-position:-2633px 0px +} +.country-select .flag.kg{ + height:12px; + background-position:-2655px 0px +} +.country-select .flag.kh{ + height:13px; + background-position:-2677px 0px +} +.country-select .flag.ki{ + height:10px; + background-position:-2699px 0px +} +.country-select .flag.km{ + height:12px; + background-position:-2721px 0px +} +.country-select .flag.kn{ + height:14px; + background-position:-2743px 0px +} +.country-select .flag.kp{ + height:10px; + background-position:-2765px 0px +} +.country-select .flag.kr{ + height:14px; + background-position:-2787px 0px +} +.country-select .flag.kw{ + height:10px; + background-position:-2809px 0px +} +.country-select .flag.ky{ + height:10px; + background-position:-2831px 0px +} +.country-select .flag.kz{ + height:10px; + background-position:-2853px 0px +} +.country-select .flag.la{ + height:14px; + background-position:-2875px 0px +} +.country-select .flag.lb{ + height:14px; + background-position:-2897px 0px +} +.country-select .flag.lc{ + height:10px; + background-position:-2919px 0px +} +.country-select .flag.li{ + height:12px; + background-position:-2941px 0px +} +.country-select .flag.lk{ + height:10px; + background-position:-2963px 0px +} +.country-select .flag.lr{ + height:11px; + background-position:-2985px 0px +} +.country-select .flag.ls{ + height:14px; + background-position:-3007px 0px +} +.country-select .flag.lt{ + height:12px; + background-position:-3029px 0px +} +.country-select .flag.lu{ + height:12px; + background-position:-3051px 0px +} +.country-select .flag.lv{ + height:10px; + background-position:-3073px 0px +} +.country-select .flag.ly{ + height:10px; + background-position:-3095px 0px +} +.country-select .flag.ma{ + height:14px; + background-position:-3117px 0px +} +.country-select .flag.mc{ + height:15px; + background-position:-3139px 0px +} +.country-select .flag.md{ + height:10px; + background-position:-3160px 0px +} +.country-select .flag.me{ + height:10px; + background-position:-3182px 0px +} +.country-select .flag.mf{ + height:14px; + background-position:-3204px 0px +} +.country-select .flag.mg{ + height:14px; + background-position:-3226px 0px +} +.country-select .flag.mh{ + height:11px; + background-position:-3248px 0px +} +.country-select .flag.mk{ + height:10px; + background-position:-3270px 0px +} +.country-select .flag.ml{ + height:14px; + background-position:-3292px 0px +} +.country-select .flag.mm{ + height:14px; + background-position:-3314px 0px +} +.country-select .flag.mn{ + height:10px; + background-position:-3336px 0px +} +.country-select .flag.mo{ + height:14px; + background-position:-3358px 0px +} +.country-select .flag.mp{ + height:10px; + background-position:-3380px 0px +} +.country-select .flag.mq{ + height:14px; + background-position:-3402px 0px +} +.country-select .flag.mr{ + height:14px; + background-position:-3424px 0px +} +.country-select .flag.ms{ + height:10px; + background-position:-3446px 0px +} +.country-select .flag.mt{ + height:14px; + background-position:-3468px 0px +} +.country-select .flag.mu{ + height:14px; + background-position:-3490px 0px +} +.country-select .flag.mv{ + height:14px; + background-position:-3512px 0px +} +.country-select .flag.mw{ + height:14px; + background-position:-3534px 0px +} +.country-select .flag.mx{ + height:12px; + background-position:-3556px 0px +} +.country-select .flag.my{ + height:10px; + background-position:-3578px 0px +} +.country-select .flag.mz{ + height:14px; + background-position:-3600px 0px +} +.country-select .flag.na{ + height:14px; + background-position:-3622px 0px +} +.country-select .flag.nc{ + height:10px; + background-position:-3644px 0px +} +.country-select .flag.ne{ + height:15px; + background-position:-3666px 0px +} +.country-select .flag.nf{ + height:10px; + background-position:-3686px 0px +} +.country-select .flag.ng{ + height:10px; + background-position:-3708px 0px +} +.country-select .flag.ni{ + height:12px; + background-position:-3730px 0px +} +.country-select .flag.nl{ + height:14px; + background-position:-3752px 0px +} +.country-select .flag.no{ + height:15px; + background-position:-3774px 0px +} +.country-select .flag.np{ + height:15px; + background-position:-3796px 0px; + background-color:transparent +} +.country-select .flag.nr{ + height:10px; + background-position:-3811px 0px +} +.country-select .flag.nu{ + height:10px; + background-position:-3833px 0px +} +.country-select .flag.nz{ + height:10px; + background-position:-3855px 0px +} +.country-select .flag.om{ + height:10px; + background-position:-3877px 0px +} +.country-select .flag.pa{ + height:14px; + background-position:-3899px 0px +} +.country-select .flag.pe{ + height:14px; + background-position:-3921px 0px +} +.country-select .flag.pf{ + height:14px; + background-position:-3943px 0px +} +.country-select .flag.pg{ + height:15px; + background-position:-3965px 0px +} +.country-select .flag.ph{ + height:10px; + background-position:-3987px 0px +} +.country-select .flag.pk{ + height:14px; + background-position:-4009px 0px +} +.country-select .flag.pl{ + height:13px; + background-position:-4031px 0px +} +.country-select .flag.pm{ + height:14px; + background-position:-4053px 0px +} +.country-select .flag.pn{ + height:10px; + background-position:-4075px 0px +} +.country-select .flag.pr{ + height:14px; + background-position:-4097px 0px +} +.country-select .flag.ps{ + height:10px; + background-position:-4119px 0px +} +.country-select .flag.pt{ + height:14px; + background-position:-4141px 0px +} +.country-select .flag.pw{ + height:13px; + background-position:-4163px 0px +} +.country-select .flag.py{ + height:11px; + background-position:-4185px 0px +} +.country-select .flag.qa{ + height:8px; + background-position:-4207px 0px +} +.country-select .flag.re{ + height:14px; + background-position:-4229px 0px +} +.country-select .flag.ro{ + height:14px; + background-position:-4251px 0px +} +.country-select .flag.rs{ + height:14px; + background-position:-4273px 0px +} +.country-select .flag.ru{ + height:14px; + background-position:-4295px 0px +} +.country-select .flag.rw{ + height:14px; + background-position:-4317px 0px +} +.country-select .flag.sa{ + height:14px; + background-position:-4339px 0px +} +.country-select .flag.sb{ + height:10px; + background-position:-4361px 0px +} +.country-select .flag.sc{ + height:10px; + background-position:-4383px 0px +} +.country-select .flag.sd{ + height:10px; + background-position:-4405px 0px +} +.country-select .flag.se{ + height:13px; + background-position:-4427px 0px +} +.country-select .flag.sg{ + height:14px; + background-position:-4449px 0px +} +.country-select .flag.sh{ + height:10px; + background-position:-4471px 0px +} +.country-select .flag.si{ + height:10px; + background-position:-4493px 0px +} +.country-select .flag.sj{ + height:15px; + background-position:-4515px 0px +} +.country-select .flag.sk{ + height:14px; + background-position:-4537px 0px +} +.country-select .flag.sl{ + height:14px; + background-position:-4559px 0px +} +.country-select .flag.sm{ + height:15px; + background-position:-4581px 0px +} +.country-select .flag.sn{ + height:14px; + background-position:-4603px 0px +} +.country-select .flag.so{ + height:14px; + background-position:-4625px 0px +} +.country-select .flag.sr{ + height:14px; + background-position:-4647px 0px +} +.country-select .flag.ss{ + height:10px; + background-position:-4669px 0px +} +.country-select .flag.st{ + height:10px; + background-position:-4691px 0px +} +.country-select .flag.sv{ + height:12px; + background-position:-4713px 0px +} +.country-select .flag.sx{ + height:14px; + background-position:-4735px 0px +} +.country-select .flag.sy{ + height:14px; + background-position:-4757px 0px +} +.country-select .flag.sz{ + height:14px; + background-position:-4779px 0px +} +.country-select .flag.ta{ + height:10px; + background-position:-4801px 0px +} +.country-select .flag.tc{ + height:10px; + background-position:-4823px 0px +} +.country-select .flag.td{ + height:14px; + background-position:-4845px 0px +} +.country-select .flag.tf{ + height:14px; + background-position:-4867px 0px +} +.country-select .flag.tg{ + height:13px; + background-position:-4889px 0px +} +.country-select .flag.th{ + height:14px; + background-position:-4911px 0px +} +.country-select .flag.tj{ + height:10px; + background-position:-4933px 0px +} +.country-select .flag.tk{ + height:10px; + background-position:-4955px 0px +} +.country-select .flag.tl{ + height:10px; + background-position:-4977px 0px +} +.country-select .flag.tm{ + height:14px; + background-position:-4999px 0px +} +.country-select .flag.tn{ + height:14px; + background-position:-5021px 0px +} +.country-select .flag.to{ + height:10px; + background-position:-5043px 0px +} +.country-select .flag.tr{ + height:14px; + background-position:-5065px 0px +} +.country-select .flag.tt{ + height:12px; + background-position:-5087px 0px +} +.country-select .flag.tv{ + height:10px; + background-position:-5109px 0px +} +.country-select .flag.tw{ + height:14px; + background-position:-5131px 0px +} +.country-select .flag.tz{ + height:14px; + background-position:-5153px 0px +} +.country-select .flag.ua{ + height:14px; + background-position:-5175px 0px +} +.country-select .flag.ug{ + height:14px; + background-position:-5197px 0px +} +.country-select .flag.um{ + height:11px; + background-position:-5219px 0px +} +.country-select .flag.us{ + height:11px; + background-position:-5241px 0px +} +.country-select .flag.uy{ + height:14px; + background-position:-5263px 0px +} +.country-select .flag.uz{ + height:10px; + background-position:-5285px 0px +} +.country-select .flag.va{ + height:15px; + background-position:-5307px 0px +} +.country-select .flag.vc{ + height:14px; + background-position:-5324px 0px +} +.country-select .flag.ve{ + height:14px; + background-position:-5346px 0px +} +.country-select .flag.vg{ + height:10px; + background-position:-5368px 0px +} +.country-select .flag.vi{ + height:14px; + background-position:-5390px 0px +} +.country-select .flag.vn{ + height:14px; + background-position:-5412px 0px +} +.country-select .flag.vu{ + height:12px; + background-position:-5434px 0px +} +.country-select .flag.wf{ + height:14px; + background-position:-5456px 0px +} +.country-select .flag.ws{ + height:10px; + background-position:-5478px 0px +} +.country-select .flag.xk{ + height:15px; + background-position:-5500px 0px +} +.country-select .flag.ye{ + height:14px; + background-position:-5522px 0px +} +.country-select .flag.yt{ + height:14px; + background-position:-5544px 0px +} +.country-select .flag.za{ + height:14px; + background-position:-5566px 0px +} +.country-select .flag.zm{ + height:14px; + background-position:-5588px 0px +} +.country-select .flag.zw{ + height:10px; + background-position:-5610px 0px +} \ No newline at end of file diff --git a/jams-server/src/main/resources/webapp/js/api.js b/jams-server/src/main/resources/webapp/js/api.js index 9cc4bcabfe91ca4ebfaf308e3383dc39827b9731..878387dcdee5d2dc50d35f25e7a0513871717621 100644 --- a/jams-server/src/main/resources/webapp/js/api.js +++ b/jams-server/src/main/resources/webapp/js/api.js @@ -39,7 +39,7 @@ var server_parameters_page = 'server-parameters.html'; var api_path_post_install_admin = '/api/install/start'; var api_path_post_auth_login = '/api/auth/login'; var api_path_post_install_ca = '/api/install/ca'; -var api_path_post_install_auth = '/api/jumpstart/setupAuth'; +var api_path_post_install_auth = '/api/install/auth'; var api_path_post_install_server = '/api/jumpstart/setupServer'; var api_path_get_install_lastKnownStep = '/api/install/lastStep'; var api_path_get_auth_users = '/api/auth/users'; @@ -84,7 +84,20 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction if (credentials) { ajax['headers'] = { "Authorization": "Basic " + btoa(credentials["username"] + ':' + credentials["password"]), - }} + } + } + + if (window.localStorage.getItem('access_token')) { + + var jwt = localStorage.getItem('access_token'); + console.log(jwt); + console.log(data); + + ajax['headers'] = { + "Bearer": jwt, + } + } + // pass data in the header if (data) { if (api_path == api_path_get_user_extended_data || api_path == api_path_get_auth_user_search || api_path == api_path_get_user_needs_reset) @@ -95,8 +108,20 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction ajax['data'] = data; } else { + + if (window.localStorage.getItem('access_token')) { + + var jwt = localStorage.getItem('access_token'); + console.log(jwt); + + ajax['headers'] = { + "Bearer": jwt, + } + } + ajax['headers'] = { - "Content-type":"application/json" + "Content-type":"application/json", + "Bearer": jwt } ajax['data'] = JSON.stringify(data); } diff --git a/jams-server/src/main/resources/webapp/js/auth.js b/jams-server/src/main/resources/webapp/js/auth.js index 7370560fdacf2317f2ca8fcf6da5ecf3e7c1206f..c298860c11588e4443f30cdd170590eca9041a07 100644 --- a/jams-server/src/main/resources/webapp/js/auth.js +++ b/jams-server/src/main/resources/webapp/js/auth.js @@ -131,27 +131,27 @@ function serverConfigStatus(data, statusCode, jqXHR) { } function lastServerConfigurationStepUri(data, statusCode, jqXHR) { - if (jqXHR.status == 200) { - // lastKnownStep - var current_page = false; - uri_endpoint = data.uri; - if (uri_endpoint == api_path_post_install_ca) { - uri = ca_setup_page; - } - else if (uri_endpoint == api_path_post_install_auth) { - uri = identity_management_page; - } - else if (uri_endpoint == api_path_post_install_server) { - uri = server_parameters_page; - } - // redirect to lastKnownStep - if (!(current_uri.includes(uri))) { - window.location.replace(uri); - } - } - else { - invalidLogin(); - } + // if (jqXHR.status == 200) { + // // lastKnownStep + // var current_page = false; + // uri_endpoint = data.uri; + // if (uri_endpoint == api_path_post_install_ca) { + // uri = ca_setup_page; + // } + // else if (uri_endpoint == api_path_post_install_auth) { + // uri = identity_management_page; + // } + // else if (uri_endpoint == api_path_post_install_server) { + // uri = server_parameters_page; + // } + // // redirect to lastKnownStep + // if (!(current_uri.includes(uri))) { + // window.location.replace(uri); + // } + // } + // else { + // invalidLogin(); + // } } function invalidLogin() { diff --git a/jams-server/src/main/resources/webapp/js/cookies-manager.js b/jams-server/src/main/resources/webapp/js/cookies-manager.js index 35de281caf10c83796827894afae6e4374867869..e3e23f662cc4f60f64cef1373ba4ec0bf9a75e14 100644 --- a/jams-server/src/main/resources/webapp/js/cookies-manager.js +++ b/jams-server/src/main/resources/webapp/js/cookies-manager.js @@ -24,12 +24,9 @@ function setCookie(key, value, expiry) { document.cookie = key + '=' + value + ';expires=' + expires.toUTCString(); } -/* If you want to set the cookie to all the path/page/directory then set path attribute to the cookie -function setCookie(key, value, expiry) { - var expires = new Date(); - expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000)); - document.cookie = key + '=' + value + ';path=/' + ';expires=' + expires.toUTCString(); -}*/ +function setJWT(value) { + window.localStorage.setItem('access_token', value.access_token); +} function getCookie(key) { var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); @@ -40,3 +37,4 @@ function eraseCookie(key) { var keyValue = getCookie(key); setCookie(key, keyValue, '-1'); } + diff --git a/jams-server/src/main/resources/webapp/js/identity-management.js b/jams-server/src/main/resources/webapp/js/identity-management.js index ad02ef67c352ca3176c67f0b9e409c8912c72d85..b700e0196d0bbffd7cd12ae933021805a965bc67 100644 --- a/jams-server/src/main/resources/webapp/js/identity-management.js +++ b/jams-server/src/main/resources/webapp/js/identity-management.js @@ -27,11 +27,16 @@ $("#inputIdentityManagmentType").change(function () { // Embedded $("#HSQL-form").submit(function (event) { event.preventDefault(); - var inputs = { + var authSource = {}; + var settings = { "CN": "http://ns.jami.net" }; - var data = inputs; - postParamaters(data); + + authSource['type'] = 'LOCAL'; + authSource['localAuthSettings'] = settings; + var data = authSource; + // post request + postParameters(data); }); // LDAP @@ -47,35 +52,56 @@ $("#AD-form").submit(function (event) { }); function setLDAPParametersData(form) { - var inputs = {} + var authSource = {}; + var settings = {}; $.each(($(form).serializeArray()), function (i, field){ if (field.name == 'useStartTLS') - inputs[field.name] = $.parseJSON(field.value); + settings[field.name] = $.parseJSON(field.value); else - inputs[field.name] = field.value; + settings[field.name] = field.value; }); - var data = inputs; + // settings['usernameField'] = "uid"; + // settings['realm'] = "savoirfairelinux"; + settings['fieldMappings'] = {}; + settings['fieldMappings']['givenName'] = "FirstName"; + settings['fieldMappings']['sn'] = "LastName"; + settings['fieldMappings']['jpegPhoto'] = "ProfilePicture"; + settings['fieldMappings']['mail'] = "Email"; + settings['fieldMappings']['telephoneNumber'] = "PhoneNumber"; + settings['fieldMappings']['mobile'] = "MobileNumber"; + settings['fieldMappings']['facsimileTelephoneNumber'] = "FaxNumber"; + settings['fieldMappings']['extensionName'] = "PhoneNumberExtension"; + settings['fieldMappings']['o'] = "Organization"; + console.log(settings); + + authSource['type'] = 'LDAP'; + authSource['ldapSettings'] = settings; + var data = authSource; // post request - postParamaters(data); + postParameters(data); } function setADParametersData(form) { - var inputs = {} + var authSource = {}; + var settings = {}; $.each(($(form).serializeArray()), function (i, field){ if (field.name == 'port') - inputs[field.name] = parseInt(field.value); + settings[field.name] = parseInt(field.value); else if (field.name == 'isSSL') - inputs[field.name] = $.parseJSON(field.value); + settings[field.name] = $.parseJSON(field.value); else - inputs[field.name] = field.value; + settings[field.name] = field.value; }); - var data = inputs; + + authSource['type'] = 'AD'; + authSource['activeDirectorySettings'] = settings; + var data = authSource; // post request - postParamaters(data); + postParameters(data); } // send post request -function postParamaters(data) { +function postParameters(data) { usePublicNS = $('#publicNS')[0].checked; var callback = set_installation_response("server-parameters.html" + "?usePublicNS=" + usePublicNS); diff --git a/jams-server/src/main/resources/webapp/js/signup.js b/jams-server/src/main/resources/webapp/js/signup.js index db8173de0ab9e3c8124f6f2dde239c578d21db20..d15fb96b65a163a1a6b5dc2d370cb89728e77c9f 100644 --- a/jams-server/src/main/resources/webapp/js/signup.js +++ b/jams-server/src/main/resources/webapp/js/signup.js @@ -87,12 +87,9 @@ function createAdminCallBackHandler(data, statusCode, jqXHR) { console.log(data); console.log(statusCode); console.log(jqXHR); - if (jqXHR.status == 200 && data.token != 'null') { - date.setTime(date.getTime() + (minutes * 60 * 1000)); + if (jqXHR.status == 200 && data.access_token != 'null') { // set username token - setCookie(keyUsername, jsonData['username'], { expires: date }); - // set isAdmin token - setCookie(keyAdmin, true, { expires: date }); + setJWT(data); window.location.replace("ca-setup.html"); } } diff --git a/jams-server/src/main/resources/webapp/templates/config.html b/jams-server/src/main/resources/webapp/templates/config.html index 9ac1afc1f22414d9e3f055513b8739300956820b..6057afdd33d2cfb5c3e12ac5b4872e251df9af5d 100644 --- a/jams-server/src/main/resources/webapp/templates/config.html +++ b/jams-server/src/main/resources/webapp/templates/config.html @@ -302,7 +302,7 @@ <div class="form-label-group"> <div class="label-title">Server Address</div> <div class="label-description"></div> - <input type="text" name="serverURI" class="form-control" required autocomplete="off" value=""/> + <input type="text" name="host" class="form-control" required autocomplete="off" value=""/> </div> <div class="form-label-group"> <div class="label-title">Administrator Username <i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Please use LDAP convention (ex : cn=name, ou=unit, dc=domain)"></i></div> @@ -324,7 +324,7 @@ <div class="label-description"></div> <div class="select_wrapper-picker"> <select name="usernameField" id="usernameField" class="selectpicker" required> - <option value="uid=%s">UID</option> + <option value="uid">UID</option> </select> </div> </div> @@ -353,8 +353,8 @@ <div data-name="useStartTLS"></div> </div> <div class="label-description d-flex"> - <div class="mr-2" data-label="serverURI">Server Address:</div> - <div data-name="serverURI"></div> + <div class="mr-2" data-label="host">Server Address:</div> + <div data-name="host"></div> </div> <div class="label-description d-flex"> <div class="mr-2" data-label="user">Administrator Username:</div> diff --git a/jams-server/src/main/resources/webapp/templates/identity-management.html b/jams-server/src/main/resources/webapp/templates/identity-management.html index 4c01a6d6343f5cf3a9c5d0a5e9c54cf96a9ad7f2..d8a0d70b96f803b3da0f9c21b64d8aac2b6820ee 100644 --- a/jams-server/src/main/resources/webapp/templates/identity-management.html +++ b/jams-server/src/main/resources/webapp/templates/identity-management.html @@ -66,7 +66,7 @@ <select name="backendType" id="inputIdentityManagmentType" class="selectpicker" required> <option value="LDAP-form">LDAP Server</option> <option value="AD-form">Active Directory</option> - <option value="HSQL-form">Local HSQL Database</option> + <option value="HSQL-form">Local Derby Database</option> </select> </div> </div> @@ -85,12 +85,12 @@ <div class="form-label-group"> <div class="label-title">Server Address</div> <div class="label-description"></div> - <input type="text" name="serverURI" class="form-control" required autocomplete="off" value=""/> + <input type="text" name="host" class="form-control" required autocomplete="off" value=""/> </div> <div class="form-label-group"> <div class="label-title">Administrator Username <i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Please use LDAP convention (ex : cn=name, ou=unit, dc=domain)"></i></div> <div class="label-description"></div> - <input type="text" name="user" class="form-control" required autocomplete="off" value=""/> + <input type="text" name="username" class="form-control" required autocomplete="off" value=""/> </div> <div class="form-label-group"> <div class="label-title">Password</div> @@ -107,7 +107,7 @@ <div class="label-description"></div> <div class="select_wrapper-picker"> <select name="usernameField" id="usernameField" class="selectpicker" required> - <option value="uid=%s">UID</option> + <option value="uid">UID</option> </select> </div> </div>