Codota Logo
CredentialService.create
Code IndexAdd Codota to your IDE (free)

How to use
create
method
in
org.eclipse.kapua.service.authentication.credential.CredentialService

Best Java code snippets using org.eclipse.kapua.service.authentication.credential.CredentialService.create (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: eclipse/kapua

/**
 * Creates a new Credential based on the information provided in CredentialCreator
 * parameter.
 *
 * @param scopeId
 *            The {@link ScopeId} in which to create the {@link Credential}
 * @param credentialCreator
 *            Provides the information for the new Credential to be created.
 * @return The newly created Credential object.
 * @throws Exception
 *             Whenever something bad happens. See specific {@link KapuaService} exceptions.
 * @since 1.0.0
 */
@ApiOperation(nickname = "credentialCreate", value = "Create a Credential", notes = "Creates a new Credential based on the information provided in CredentialCreator parameter.", response = Credential.class)
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Credential create(
    @ApiParam(value = "The ScopeId in which to create the Credential", required = true, defaultValue = DEFAULT_SCOPE_ID) @PathParam("scopeId") ScopeId scopeId,
    @ApiParam(value = "Provides the information for the new Credential to be created", required = true) CredentialCreator credentialCreator) throws Exception {
  credentialCreator.setScopeId(scopeId);
  return credentialService.create(credentialCreator);
}
origin: eclipse/kapua

public void attachUserCredentials(Account account, User user) throws KapuaException {
  KapuaSecurityUtils.doPrivileged(() -> {
    CredentialCreator credentialCreator;
    credentialCreator = new CredentialFactoryImpl().newCreator(account.getId(), user.getId(), CredentialType.PASSWORD, "KeepCalm123.", CredentialStatus.ENABLED, null);
    try {
      credentialService.create(credentialCreator);
    } catch (KapuaException ke) {
      // skip
    }
    return null;
  });
}
origin: eclipse/kapua

public void attachUserCredentials(Account account, User user, String password) throws KapuaException {
  KapuaSecurityUtils.doPrivileged(() -> {
    CredentialCreator credentialCreator;
    credentialCreator = new CredentialFactoryImpl().newCreator(account.getId(), user.getId(), CredentialType.PASSWORD, password, CredentialStatus.ENABLED, null);
    try {
      credentialService.create(credentialCreator);
    } catch (KapuaException ke) {
      // skip
    }
    return null;
  });
}
origin: eclipse/kapua

/**
 * Create credentials for specific user, set users password.
 * It finds user by name and sets its password.
 *
 * @param testCredentials username and open password
 * @return created credential
 */
private Credential createCredentials(TestCredentials testCredentials) throws Exception {
  List<Credential> credentialList = new ArrayList<>();
  KapuaSecurityUtils.doPrivileged(() -> {
    primeException();
    try {
      User user = userService.findByName(testCredentials.getName());
      Credential credential = credentialService.create(credentialCreatorCreator(user.getScopeId(),
          user.getId(), testCredentials.getPassword(),
          testCredentials.getStatus(), testCredentials.getExpirationDate()));
      credentialList.add(credential);
    } catch (KapuaException ke) {
      verifyException(ke);
    }
    return null;
  });
  return credentialList.size() == 1 ? credentialList.get(0) : null;
}
origin: eclipse/kapua

private User createBrokerUser(String baseName, Account account) throws KapuaException {
  // define
  UserCreator userCreator = userFactory.newCreator(account.getId(), baseName + "-broker");
  userCreator.setUserType(UserType.INTERNAL); // FIXME: need to find out why this isn't DEVICE but INTERNAL
  userCreator.setDisplayName("Gateway User");
  // create
  User user = userService.create(userCreator);
  // assign permissions
  AccessInfoCreator accessInfoCreator = accessInfoFactory.newCreator(user.getScopeId());
  accessInfoCreator.setUserId(user.getId());
  Set<Permission> permissions = new HashSet<>();
  permissions.add(permissionFactory.newPermission(BrokerDomains.BROKER_DOMAIN, Actions.connect, user.getScopeId()));
  accessInfoCreator.setPermissions(permissions);
  accessInfoService.create(accessInfoCreator);
  // Create default password
  CredentialCreator credential = credentialFactory.newCreator(account.getId(), user.getId(), CredentialType.PASSWORD, baseName + "-password", CredentialStatus.ENABLED, null);
  credentialService.create(credential);
  return user;
}
org.eclipse.kapua.service.authentication.credentialCredentialServicecreate

Popular methods of CredentialService

  • update
  • count
  • delete
  • find
  • findByApiKey
    Returns the Credential of type CredentialType#API_KEY matching the given parameters
  • findByUserId
    Return the credential list result looking by user identifier (and also scope identifier)
  • getConfigValues
  • query
  • setConfigValues
  • unlock
    Unlocks a Credential

Popular in Java

  • Creating JSON documents from java classes using gson
  • setContentView (Activity)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now