Search in sources :

Example 1 with OrcidWebRole

use of org.orcid.core.security.OrcidWebRole in project ORCID-Source by ORCID.

the class ManageProfileControllerTest method getAuthentication.

protected Authentication getAuthentication(String orcid) {
    List<OrcidWebRole> roles = Arrays.asList(OrcidWebRole.ROLE_USER);
    OrcidProfileUserDetails details = new OrcidProfileUserDetails(orcid, "user_1@test.orcid.org", null, roles);
    UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(orcid, null, roles);
    auth.setDetails(details);
    return auth;
}
Also used : OrcidWebRole(org.orcid.core.security.OrcidWebRole) OrcidProfileUserDetails(org.orcid.core.oauth.OrcidProfileUserDetails) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken)

Example 2 with OrcidWebRole

use of org.orcid.core.security.OrcidWebRole in project ORCID-Source by ORCID.

the class AdminControllerTest method getAuthentication.

@Override
protected Authentication getAuthentication() {
    orcidProfile = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4440");
    List<OrcidWebRole> roles = getRole();
    OrcidProfileUserDetails details = new OrcidProfileUserDetails(orcidProfile.retrieveOrcidPath(), orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(), null, roles);
    UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(orcidProfile.retrieveOrcidPath(), orcidProfile.getPassword(), getRole());
    auth.setDetails(details);
    return auth;
}
Also used : OrcidWebRole(org.orcid.core.security.OrcidWebRole) OrcidProfileUserDetails(org.orcid.core.oauth.OrcidProfileUserDetails) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken)

Example 3 with OrcidWebRole

use of org.orcid.core.security.OrcidWebRole in project ORCID-Source by ORCID.

the class ManageMembersControllerTest method getAuthentication.

protected Authentication getAuthentication() {
    List<OrcidWebRole> roles = Arrays.asList(OrcidWebRole.ROLE_GROUP);
    OrcidProfileUserDetails details = new OrcidProfileUserDetails("5555-5555-5555-0000", "premium_institution@group.com", "", roles);
    UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(details, "5555-5555-5555-0000", roles);
    return auth;
}
Also used : OrcidWebRole(org.orcid.core.security.OrcidWebRole) OrcidProfileUserDetails(org.orcid.core.oauth.OrcidProfileUserDetails) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken)

Example 4 with OrcidWebRole

use of org.orcid.core.security.OrcidWebRole in project ORCID-Source by ORCID.

the class FundingsControllerTest method getAuthentication.

@Override
protected Authentication getAuthentication() {
    orcidProfile = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4443");
    List<OrcidWebRole> roles = Arrays.asList(OrcidWebRole.ROLE_USER);
    OrcidProfileUserDetails details = new OrcidProfileUserDetails(orcidProfile.retrieveOrcidPath(), orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue(), null, roles);
    UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken("4444-4444-4444-4443", details.getPassword(), roles);
    auth.setDetails(details);
    return auth;
}
Also used : OrcidWebRole(org.orcid.core.security.OrcidWebRole) OrcidProfileUserDetails(org.orcid.core.oauth.OrcidProfileUserDetails) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken)

Example 5 with OrcidWebRole

use of org.orcid.core.security.OrcidWebRole in project ORCID-Source by ORCID.

the class GetMyDataControllerTest method getAuthentication.

private Authentication getAuthentication() {
    List<OrcidWebRole> roles = Arrays.asList(OrcidWebRole.ROLE_USER);
    OrcidProfileUserDetails details = new OrcidProfileUserDetails(ORCID, "user_1@test.orcid.org", null, roles);
    UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(ORCID, null, roles);
    auth.setDetails(details);
    return auth;
}
Also used : OrcidWebRole(org.orcid.core.security.OrcidWebRole) OrcidProfileUserDetails(org.orcid.core.oauth.OrcidProfileUserDetails) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken)

Aggregations

OrcidProfileUserDetails (org.orcid.core.oauth.OrcidProfileUserDetails)5 OrcidWebRole (org.orcid.core.security.OrcidWebRole)5 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)5