示例#1
0
            @Override
            public void config(
                RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {
              ClientModel app = appRealm.addClient("service-account-cl");
              app.setSecret("secret1");
              new ClientManager(manager).enableServiceAccount(app);

              ClientModel disabledApp = appRealm.addClient("service-account-disabled");
              disabledApp.setSecret("secret1");

              UserModel serviceAccountUser =
                  session
                      .users()
                      .getUserByUsername(
                          ServiceAccountConstants.SERVICE_ACCOUNT_USER_PREFIX
                              + "service-account-cl",
                          appRealm);
              userId = serviceAccountUser.getId();
            }
            @Override
            public void config(
                RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {
              ClientModel app = appRealm.addClient("resource-owner");
              app.setSecret("secret");

              UserModel user = session.users().addUser(appRealm, "direct-login");
              user.setEmail("direct-login@localhost");
              user.setEnabled(true);

              userId = user.getId();

              session
                  .users()
                  .updateCredential(appRealm, user, UserCredentialModel.password("password"));
            }
示例#3
0
 public void setSecret(String secret) {
   getDelegateForUpdate();
   updated.setSecret(secret);
 }