本文整理汇总了Java中org.jasig.cas.services.RegisteredService.INITIAL_IDENTIFIER_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java RegisteredService.INITIAL_IDENTIFIER_VALUE属性的具体用法?Java RegisteredService.INITIAL_IDENTIFIER_VALUE怎么用?Java RegisteredService.INITIAL_IDENTIFIER_VALUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jasig.cas.services.RegisteredService
的用法示例。
在下文中一共展示了RegisteredService.INITIAL_IDENTIFIER_VALUE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
@Override
public RegisteredService save(final RegisteredService rs) {
if (this.ldapServiceMapper != null) {
if (rs.getId() != RegisteredService.INITIAL_IDENTIFIER_VALUE) {
return update(rs);
}
try {
final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.baseDn, rs);
LdapUtils.executeAddOperation(this.connectionFactory, entry);
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
}
return rs;
}
return null;
}
示例2: mapFromRegisteredService
@Override
public LdapEntry mapFromRegisteredService(final String dn, final RegisteredService svc) {
try {
if (svc.getId() == RegisteredService.INITIAL_IDENTIFIER_VALUE) {
((AbstractRegisteredService) svc).setId(System.nanoTime());
}
final String newDn = getDnForRegisteredService(dn, svc);
LOGGER.debug("Creating entry {}", newDn);
final Collection<LdapAttribute> attrs = new ArrayList<>();
attrs.add(new LdapAttribute(this.idAttribute, String.valueOf(svc.getId())));
final StringWriter writer = new StringWriter();
this.jsonSerializer.toJson(writer, svc);
attrs.add(new LdapAttribute(this.serviceDefinitionAttribute, writer.toString()));
attrs.add(new LdapAttribute(LdapUtils.OBJECTCLASS_ATTRIBUTE, "top", this.objectClass));
return new LdapEntry(newDn, attrs);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:DefaultLdapRegisteredServiceMapper.java
示例3: save
@Override
public RegisteredService save(final RegisteredService rs) {
if (rs.getId() != RegisteredService.INITIAL_IDENTIFIER_VALUE) {
return update(rs);
}
Connection connection = null;
try {
connection = getConnection();
final AddOperation operation = new AddOperation(connection);
final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.searchRequest.getBaseDn(), rs);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
} finally {
LdapUtils.closeConnection(connection);
}
return rs;
}
示例4: save
@Override
public RegisteredService save(final RegisteredService rs) {
if (rs.getId() != RegisteredService.INITIAL_IDENTIFIER_VALUE) {
return update(rs);
}
Connection connection = null;
try {
connection = this.connectionFactory.getConnection();
final AddOperation operation = new AddOperation(connection);
final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.searchRequest.getBaseDn(), rs);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
} finally {
LdapUtils.closeConnection(connection);
}
return rs;
}
示例5: save
@Override
public RegisteredService save(final RegisteredService rs) {
if (this.ldapServiceMapper != null && this.searchRequest != null) {
if (rs.getId() != RegisteredService.INITIAL_IDENTIFIER_VALUE) {
return update(rs);
}
try (final Connection connection = getConnection()) {
final AddOperation operation = new AddOperation(connection);
final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.searchRequest.getBaseDn(), rs);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
}
return rs;
}
return null;
}
示例6: saveService
/**
* Adds the service to the Service Registry.
* @param request the request
* @param response the response
* @param result the result
* @param service the edit bean
*/
@RequestMapping(method = RequestMethod.POST, value = {"saveService.html"})
public void saveService(final HttpServletRequest request,
final HttpServletResponse response,
@RequestBody final RegisteredServiceEditBean.ServiceData service,
final BindingResult result) {
try {
final RegisteredService svcToUse = service.toRegisteredService(this.personAttributeDao);
if (svcToUse.getId() != RegisteredService.INITIAL_IDENTIFIER_VALUE) {
final RegisteredService curService = this.servicesManager.findServiceBy(svcToUse.getId());
if (curService != null && this.servicesManager.delete(curService.getId()) == null) {
throw new IllegalArgumentException("Service " + curService.getId() + " cannot be updated");
}
}
final RegisteredService newSvc = this.servicesManager.save(svcToUse);
logger.info("Saved changes to service {}", svcToUse.getId());
final Map<String, Object> model = new HashMap<>();
model.put("id", newSvc.getId());
model.put("status", HttpServletResponse.SC_OK);
JsonViewUtils.render(model, response);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:34,代码来源:RegisteredServiceSimpleFormController.java
示例7: mapFromRegisteredService
@Override
public LdapEntry mapFromRegisteredService(final String dn, final RegisteredService svc) {
if (svc.getId() == RegisteredService.INITIAL_IDENTIFIER_VALUE) {
((AbstractRegisteredService) svc).setId(System.nanoTime());
}
final String newDn = getDnForRegisteredService(dn, svc);
LOGGER.debug("Creating entry {}", newDn);
final Collection<LdapAttribute> attrs = new ArrayList<LdapAttribute>();
attrs.add(new LdapAttribute(this.idAttribute, String.valueOf(svc.getId())));
attrs.add(new LdapAttribute(this.serviceIdAttribute, svc.getServiceId()));
attrs.add(new LdapAttribute(this.serviceNameAttribute, svc.getName()));
attrs.add(new LdapAttribute(this.serviceDescriptionAttribute, svc.getDescription()));
attrs.add(new LdapAttribute(this.serviceEnabledAttribute, Boolean.toString(svc.isEnabled()).toUpperCase()));
attrs.add(new LdapAttribute(this.serviceAllowedToProxyAttribute, Boolean.toString(svc.isAllowedToProxy()).toUpperCase()));
attrs.add(new LdapAttribute(this.serviceAnonymousAccessAttribute, Boolean.toString(svc.isAnonymousAccess()).toUpperCase()));
attrs.add(new LdapAttribute(this.serviceSsoEnabledAttribute, Boolean.toString(svc.isSsoEnabled()).toUpperCase()));
attrs.add(new LdapAttribute(this.ignoreAttributesAttribute, Boolean.toString(svc.isAnonymousAccess()).toUpperCase()));
attrs.add(new LdapAttribute(this.evaluationOrderAttribute, String.valueOf(svc.getEvaluationOrder())));
attrs.add(new LdapAttribute(this.serviceThemeAttribute, svc.getTheme()));
attrs.add(new LdapAttribute(this.usernameAttribute, svc.getUsernameAttribute()));
if (svc.getAllowedAttributes().size() > 0) {
attrs.add(new LdapAttribute(this.serviceAllowedAttributesAttribute, svc.getAllowedAttributes().toArray(new String[] {})));
}
if (svc.getRequiredHandlers().size() > 0) {
attrs.add(new LdapAttribute(this.requiredHandlersAttribute, svc.getRequiredHandlers().toArray(new String[] {})));
}
attrs.add(new LdapAttribute(LdapUtils.OBJECTCLASS_ATTRIBUTE, this.objectClass));
return new LdapEntry(newDn, attrs);
}