public void refreshAuth(final String username) { try { Pair<Map<String, Set<String>>, UserTO> self = client.self(); auth = self.getLeft(); selfTO = self.getRight(); roles = null; } catch (ForbiddenException e) { LOG.warn("Could not read self(), probably in a {} scenario", StandardEntitlement.MUST_CHANGE_PASSWORD, e); selfTO = new UserTO(); selfTO.setUsername(username); selfTO.setMustChangePassword(true); } }
public UserTemplateWizardBuilder( final UserTO template, final List<String> anyTypeClasses, final UserFormLayoutInfo formLayoutInfo, final PageReference pageRef) { super(anyTypeClasses, formLayoutInfo, pageRef); templatable = null; if (template == null) { setItem(new UserWrapper(new UserTO())); } else { setItem(new UserWrapper(template)); } }
@Override public <T extends AnyTO> T newAnyTO() { T result = null; switch (anyTypeKind) { case USER: result = (T) new UserTO(); break; case GROUP: result = (T) new GroupTO(); break; case ANY_OBJECT: result = (T) new AnyObjectTO(); break; default: } return result; }
private void afterAuthentication(final String username) { try { selfTO = client.self().getRight(); } catch (ForbiddenException e) { LOG.warn("Could not read self(), probably in a {} scenario", StandardEntitlement.MUST_CHANGE_PASSWORD, e); selfTO = new UserTO(); selfTO.setUsername(username); selfTO.setMustChangePassword(true); } // bind explicitly this session to have a stateful behavior during http requests, unless session will // expire for every request this.bind(); }
private void afterAuthentication(final String username) { try { selfTO = client.self().getRight(); } catch (ForbiddenException e) { LOG.warn("Could not read self(), probably in a {} scenario", StandardEntitlement.MUST_CHANGE_PASSWORD, e); selfTO = new UserTO(); selfTO.setUsername(username); selfTO.setMustChangePassword(true); } // bind explicitly this session to have a stateful behavior during http requests, unless session will // expire for every request this.bind(); }
@Transactional(readOnly = true) @Override public UserTO getAuthenticatedUserTO() { final UserTO authUserTO; String authUsername = AuthContextUtils.getUsername(); if (anonymousUser.equals(authUsername)) { authUserTO = new UserTO(); authUserTO.setKey(null); authUserTO.setUsername(anonymousUser); } else if (adminUser.equals(authUsername)) { authUserTO = new UserTO(); authUserTO.setKey(null); authUserTO.setUsername(adminUser); } else { User authUser = userDAO.findByUsername(authUsername); authUserTO = getUserTO(authUser, true); } return authUserTO; }
public UserTemplateWizardBuilder( final TemplatableTO templatable, final List<String> anyTypeClasses, final UserFormLayoutInfo formLayoutInfo, final PageReference pageRef) { super(anyTypeClasses, formLayoutInfo, pageRef); this.templatable = templatable; if (templatable.getTemplates().containsKey(AnyTypeKind.USER.name())) { setItem(new UserWrapper(UserTO.class.cast(templatable.getTemplates().get(AnyTypeKind.USER.name())))); } else { UserTO userTO = new UserTO(); if (templatable instanceof RealmTO) { userTO.setRealm(String.format("'%s'", RealmTO.class.cast(templatable).getFullPath())); } setItem(new UserWrapper(userTO)); } }
protected ProvisioningResult<UserTO> doDelete( final UserTO userTO, final boolean self, final boolean nullPriorityAsync) { Pair<UserTO, List<LogicActions>> before = beforeDelete(userTO); if (!self) { Set<String> effectiveRealms = RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.USER_DELETE), before.getLeft().getRealm()); securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey()); } List<Group> ownedGroups = groupDAO.findOwnedByUser(before.getLeft().getKey()); if (!ownedGroups.isEmpty()) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership); sce.getElements().addAll(ownedGroups.stream(). map(group -> group.getKey() + " " + group.getName()).collect(Collectors.toList())); throw sce; } List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync); UserTO deletedTO; if (userDAO.find(before.getLeft().getKey()) == null) { deletedTO = new UserTO(); deletedTO.setKey(before.getLeft().getKey()); } else { deletedTO = binder.getUserTO(before.getLeft().getKey()); } return afterDelete(binder.returnUserTO(deletedTO), statuses, before.getRight()); }
@Transactional(readOnly = true) @Override public UserTO getUserTO(final User user, final boolean details) { UserTO userTO = new UserTO(); userTO.setKey(user.getKey()); userTO.setUsername(user.getUsername());
@Transactional(propagation = Propagation.REQUIRES_NEW) public String create(final SAML2IdPEntity idp, final SAML2LoginResponseTO responseTO, final String nameID) { UserTO userTO = new UserTO(); if (idp.getUserTemplate() != null) { templateUtils.apply(userTO, idp.getUserTemplate()); } List<SAML2IdPActions> actions = getActions(idp); for (SAML2IdPActions action : actions) { userTO = action.beforeCreate(userTO, responseTO); } fill(idp.getKey(), responseTO, userTO); if (userTO.getRealm() == null) { userTO.setRealm(SyncopeConstants.ROOT_REALM); } if (userTO.getUsername() == null) { userTO.setUsername(nameID); } Pair<String, List<PropagationStatus>> created = provisioningManager.create(userTO, false, false); userTO = binder.getUserTO(created.getKey()); for (SAML2IdPActions action : actions) { userTO = action.afterCreate(userTO, responseTO); } return userTO.getUsername(); }
} else if (idp.isSelfRegUnmatching()) { responseTO.setNameID(nameID.getValue()); UserTO userTO = new UserTO();
@Transactional(propagation = Propagation.REQUIRES_NEW) public String create(final OIDCProvider op, final OIDCLoginResponseTO responseTO, final String email) { UserTO userTO = new UserTO(); if (op.getUserTemplate() != null && op.getUserTemplate().get() != null) { templateUtils.apply(userTO, op.getUserTemplate().get()); } List<OIDCProviderActions> actions = getActions(op); for (OIDCProviderActions action : actions) { userTO = action.beforeCreate(userTO, responseTO); } fill(op, responseTO, userTO); if (userTO.getRealm() == null) { userTO.setRealm(SyncopeConstants.ROOT_REALM); } if (userTO.getUsername() == null) { userTO.setUsername(email); } Pair<String, List<PropagationStatus>> created = provisioningManager.create(userTO, false, false); userTO = binder.getUserTO(created.getKey()); for (OIDCProviderActions action : actions) { userTO = action.afterCreate(userTO, responseTO); } return userTO.getUsername(); }
() -> userManager.create(op, responseTO, emailValue)); } else if (op.isSelfRegUnmatching()) { UserTO userTO = new UserTO();
userTO = new UserTO(); userTO.setKey(wfResult.getResult().getKey()); } else {
UserTO previousUserTO; if (remediationTO.getAnyURPayload() == null) { newUserTO = new UserTO(); EntityTOUtils.toAnyTO(remediationTO.getAnyCRPayload(), newUserTO); previousUserTO = null;
UserTO userTO = new UserTO(); userTO.setRealm(SyncopeConstants.ROOT_REALM); userTO.setKey(user.getId());
: SyncopeClient.getUserSearchConditionBuilder().inDynRealms(dynRealm).query(); final UserTO userTO = new UserTO(); userTO.setRealm(realmTO.getFullPath()); panel = new UserDirectoryPanel.Builder(