Search in sources :

Example 36 with RedirectUri

use of org.orcid.pojo.ajaxForm.RedirectUri in project ORCID-Source by ORCID.

the class ResultContainer method updateClient.

@RequestMapping(value = "/update-client.json", method = RequestMethod.POST)
@ResponseBody
public Client updateClient(@RequestBody Client client) {
    // Clean the error list
    client.setErrors(new ArrayList<String>());
    // Validate fields
    groupAdministratorController.validateDisplayName(client);
    groupAdministratorController.validateWebsite(client);
    groupAdministratorController.validateShortDescription(client);
    groupAdministratorController.validateRedirectUris(client, true);
    copyErrors(client.getDisplayName(), client);
    copyErrors(client.getWebsite(), client);
    copyErrors(client.getShortDescription(), client);
    if (client.getAuthenticationProviderId() != null) {
        validateIdP(client);
        copyErrors(client.getAuthenticationProviderId(), client);
    }
    for (RedirectUri redirectUri : client.getRedirectUris()) {
        copyErrors(redirectUri, client);
    }
    if (client.getErrors().isEmpty()) {
        org.orcid.jaxb.model.v3.dev1.client.Client modelObject = clientManager.edit(client.toModelObject(), true);
        client = Client.fromModelObject(modelObject);
        membersManager.clearCache();
    }
    return client;
}
Also used : RedirectUri(org.orcid.pojo.ajaxForm.RedirectUri) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 37 with RedirectUri

use of org.orcid.pojo.ajaxForm.RedirectUri in project ORCID-Source by ORCID.

the class ClientsController method getEmptyClient.

@RequestMapping(value = "/client.json", method = RequestMethod.GET)
@ResponseBody
public Client getEmptyClient() {
    Client emptyClient = new Client();
    emptyClient.setDisplayName(new Text());
    emptyClient.setWebsite(new Text());
    emptyClient.setShortDescription(new Text());
    emptyClient.setClientId(new Text());
    emptyClient.setClientSecret(new Text());
    emptyClient.setType(new Text());
    emptyClient.setAllowAutoDeprecate(Checkbox.valueOf(false));
    ArrayList<RedirectUri> redirectUris = new ArrayList<RedirectUri>();
    RedirectUri emptyRedirectUri = new RedirectUri();
    emptyRedirectUri.setValue(new Text());
    emptyRedirectUri.setType(Text.valueOf(RedirectUriType.DEFAULT.value()));
    emptyRedirectUri.setActType(Text.valueOf(""));
    emptyRedirectUri.setGeoArea(Text.valueOf(""));
    redirectUris.add(emptyRedirectUri);
    emptyClient.setRedirectUris(redirectUris);
    return emptyClient;
}
Also used : ArrayList(java.util.ArrayList) Text(org.orcid.pojo.ajaxForm.Text) RedirectUri(org.orcid.pojo.ajaxForm.RedirectUri) Client(org.orcid.pojo.ajaxForm.Client) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 38 with RedirectUri

use of org.orcid.pojo.ajaxForm.RedirectUri in project ORCID-Source by ORCID.

the class DeveloperToolsController method getEmptyClient.

@RequestMapping(value = "/client.json", method = RequestMethod.GET)
@ResponseBody
public Client getEmptyClient(HttpServletRequest request) {
    Client emptyObject = new Client();
    emptyObject.setClientSecret(Text.valueOf(StringUtils.EMPTY));
    RedirectUri redirectUri = new RedirectUri();
    redirectUri.setValue(new Text());
    redirectUri.setType(Text.valueOf(RedirectUriType.SSO_AUTHENTICATION.value()));
    List<RedirectUri> set = new ArrayList<RedirectUri>();
    set.add(redirectUri);
    emptyObject.setRedirectUris(set);
    return emptyObject;
}
Also used : ArrayList(java.util.ArrayList) RedirectUri(org.orcid.pojo.ajaxForm.RedirectUri) Text(org.orcid.pojo.ajaxForm.Text) Client(org.orcid.pojo.ajaxForm.Client) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

RedirectUri (org.orcid.pojo.ajaxForm.RedirectUri)38 Test (org.junit.Test)22 Client (org.orcid.pojo.ajaxForm.Client)21 ArrayList (java.util.ArrayList)15 BaseControllerTest (org.orcid.frontend.web.util.BaseControllerTest)15 Text (org.orcid.pojo.ajaxForm.Text)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 HashSet (java.util.HashSet)7 SSOCredentials (org.orcid.pojo.ajaxForm.SSOCredentials)5 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)4 Transactional (org.springframework.transaction.annotation.Transactional)4 OrcidClient (org.orcid.jaxb.model.clientgroup.OrcidClient)3 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)3 Produces (javax.ws.rs.Produces)2 OrcidClientGroupManagementException (org.orcid.core.exception.OrcidClientGroupManagementException)2 ErrorDesc (org.orcid.jaxb.model.message.ErrorDesc)2 DBUnitTest (org.orcid.test.DBUnitTest)2 UrlValidator (org.apache.commons.validator.routines.UrlValidator)1 ClientSecretEntity (org.orcid.persistence.jpa.entities.ClientSecretEntity)1