コード例 #1
0
  public static Date rptExpirationDate() {
    int lifeTime =
        ConfigurationFactory.instance().getConfiguration().getUmaRequesterPermissionTokenLifetime();
    if (lifeTime <= 0) {
      lifeTime = DEFAULT_PERMISSION_LIFETIME;
    }

    final Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.SECOND, lifeTime);
    return calendar.getTime();
  }
コード例 #2
0
ファイル: ScopeService.java プロジェクト: trintech/oxAuth
  private void handleExternalScopes(List<String> p_scopeUrls, List<String> result)
      throws LDAPException {
    for (String scopeUrl : p_scopeUrls) {
      final Filter filter = Filter.create(String.format("&(oxUrl=%s)", scopeUrl));
      final List<ScopeDescription> entries =
          ldapEntryManager.findEntries(baseDn(), ScopeDescription.class, filter);
      if (entries != null && !entries.isEmpty()) {
        result.add(entries.get(0).getDn());
      } else { // scope is not in ldap, add it dynamically

        final Boolean addAutomatically =
            ConfigurationFactory.instance().getConfiguration().getUmaAddScopesAutomatically();

        if (addAutomatically != null && addAutomatically) {
          final String inum = inumService.generateInum();
          final ScopeDescription newScope = new ScopeDescription();
          newScope.setInum(inum);
          newScope.setUrl(scopeUrl);
          newScope.setDisplayName(
              scopeUrl); // temp solution : need extract info from scope description on resource
                         // server
          newScope.setId(
              UmaScopeType.EXTERNAL_AUTO
                  .getValue()); // dummy id : not sure what to put right now as id is required by
                                // @NotNull annotation
          newScope.setType(InternalExternal.EXTERNAL_AUTO);

          final boolean persisted = persist(newScope);
          if (persisted) {
            result.add(newScope.getDn());
          }
        } else {
          throw new WebApplicationException(
              Response.status(Response.Status.BAD_REQUEST)
                  .entity(
                      errorResponseFactory.getUmaJsonErrorResponse(
                          UmaErrorResponseType.INVALID_RESOURCE_SET_SCOPE))
                  .build());
        }
      }
    }
  }
コード例 #3
0
ファイル: ScopeService.java プロジェクト: trintech/oxAuth
 public static String baseDn() {
   return String.format("ou=scopes,%s", ConfigurationFactory.instance().getBaseDn().getUmaBase());
 }
コード例 #4
0
ファイル: ScopeService.java プロジェクト: trintech/oxAuth
 private static String getScopeEndpoint() {
   return ConfigurationFactory.instance().getConfiguration().getBaseEndpoint()
       + UmaConfigurationWS.UMA_SCOPES_SUFFIX;
 }