Examples of UserInfo


Examples of org.mitre.openid.connect.model.UserInfo

  private List<String> admins = new ArrayList<String>();

  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    UserInfo userInfo = repository.getByUsername(username);

    if (userInfo != null) {

      // TODO: make passwords configurable? part of object?
      String password = "password";

      List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
      authorities.add(ROLE_USER);

      if (admins != null && admins.contains(username)) {
        authorities.add(ROLE_ADMIN);
      }

      // TODO: this should really be our own UserDetails wrapper class, shouldn't it?
      User user = new User(userInfo.getSub(), password, authorities);
      return user;
    } else {
      throw new UsernameNotFoundException("Could not find username: " + username);
    }
  }
View Full Code Here

Examples of org.mmisw.orrportal.gwt.client.CookieMan.UserInfo

      public void onSuccess(MetadataBaseInfo result) {
        Orr.log("ORR: Got MetadataBaseInfo");
        metadataBaseInfo  = result;
       
        UserInfo userInfo = CookieMan.getUserInfo();
        if ( userInfo != null && userInfo.getPassword() != null ) {
          _loginRememberedUser(userInfo, params);
        }
        else {
          _startGui(params, null);
        }
View Full Code Here

Examples of org.mmisw.orrportal.gwt.client.CookieMan.UserInfo

    userName = new TextBox();
    userName.setWidth("200");
    userPassword = new PasswordTextBox();
    userPassword.setWidth("200");
   
    UserInfo userInfo = CookieMan.getUserInfo();
    if ( userInfo != null ) {
      userName.setText(userInfo.getUsername());
      if ( userInfo.getPassword() != null ) {
        userPassword.setText(userInfo.getPassword());
        rememberMeCheckBox.setChecked(true);
      }
    }
  }
View Full Code Here

Examples of org.mortbay.jetty.plus.jaas.spi.UserInfo

        pwdCredential = convertCredentialLdapToJetty(pwdCredential);
        Credential credential = Credential.getCredential(pwdCredential);
        List roles = getUserRoles(_rootContext, username);

        return new UserInfo(username, credential, roles);
    }
View Full Code Here

Examples of org.mortbay.jetty.plus.jaas.spi.UserInfo

            {
                return bindingLogin(webUserName, webCredential);
            }

            // This sets read and the credential
            UserInfo userInfo = getUserInfo(webUserName);

            if( userInfo == null) {
                setAuthenticated(false);
                return false;
            }
View Full Code Here

Examples of org.mortbay.jetty.plus.jaas.spi.UserInfo

        DirContext dirContext = new InitialDirContext(environment);

        List roles = getUserRolesByDn(dirContext, userDn);

        UserInfo userInfo = new UserInfo(username, null, roles);
        setCurrentUser(new JAASUserInfo(userInfo));
        setAuthenticated(true);

        return true;
    }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.UserInfo

     */
    protected void refreshUserIdentity(){
        JosmUserIdentityManager im = JosmUserIdentityManager.getInstance();
        try {
            OsmServerUserInfoReader infoReader = new OsmServerUserInfoReader();
            UserInfo info = infoReader.fetchUserInfo(getProgressMonitor().createSubTaskMonitor(1, false));
            im.setFullyIdentified(info.getDisplayName(), info);
        } catch(OsmTransferException e) {
            // retrieving the user info can fail if the current user is not authorised to
            // retrieve it, i.e. if he is working with an OAuth Access Token which doesn't
            // have the respective privileges or if he didn't or he can't authenticate with
            // a username/password-pair.
View Full Code Here

Examples of org.vngx.jsch.UserInfo

   *
   * @param kex instance
   * @throws JSchException if any errors occur
   */
  private void checkHost(KexAlgorithm kex) throws JSchException {
    UserInfo _userinfo = _session.getUserInfo();

    // Check if host key alias exists and use it, or if it's not present and
    // not using default port, set the port in host to check
    String chost = _session.getHost();
    if( _session.getHostKeyAlias() != null ) {
      chost = _session.getHostKeyAlias();
    } else if( _session.getPort() != SSHConstants.DEFAULT_SSH_PORT ) {
      chost = "[" + chost + "]:" + _session.getPort();
    }

    // Check host against known hosts repository
    HostKeyRepository hkr = JSch.getInstance().getHostKeyRepository();
    Check keyCheck;
    synchronized( hkr ) {
      keyCheck = hkr.check(chost, kex.K_S);
    }

    boolean insert = false;
    String shkc = _session.getConfig().getString(SessionConfig.STRICT_HOST_KEY_CHECKING);
    if( ("ask".equals(shkc) || "yes".equals(shkc)) && keyCheck == Check.CHANGED ) {
      String file = hkr.getKnownHostsRepositoryID() != null ?
        hkr.getKnownHostsRepositoryID() : SSHConstants.KNOWN_HOSTS;

      // Notify user host key changed (ask if requested) and throw exception
      // if user doesn't accept the new key
      if( _userinfo != null ) {
        if( "ask".equals(shkc) ) {
          if( !_userinfo.promptYesNo(String.format(MessageConstants.PROMPT_REPLACE_KEY,
              kex._hostKeyType.DISPLAY_NAME, Util.getFingerPrint(kex.K_S), file)) ) {
            throw new JSchException("HostKey has changed (StrictHostKeyChecking:ask): "+chost);
          }
        } else // shkc.equals("yes")
          _userinfo.showMessage(String.format(MessageConstants.INVALID_SERVER_HOST,
              kex._hostKeyType.DISPLAY_NAME, Util.getFingerPrint(kex.K_S), file));
          throw new JSchException("HostKey has changed (StrictHostKeyChecking:yes): "+chost);
        }
      }

      // Remove the old key from the repository
      synchronized ( hkr ) {
        hkr.remove(chost, kex._hostKeyType, null);
        insert = true;
      }
    }

    if( ("ask".equals(shkc) || "yes".equals(shkc)) && keyCheck != Check.OK && !insert ) {
      if( "yes".equals(shkc) ) {
        throw new JSchException("HostKey does not match known hosts (StrictHostKeyChecking:yes): "+chost);
      }
      if( _userinfo != null ) {
        if( !_userinfo.promptYesNo(String.format(MessageConstants.PROMPT_UNKNOWN_KEY,
            chost, kex._hostKeyType.DISPLAY_NAME, Util.getFingerPrint(kex.K_S))) ) {
          throw new JSchException("HostKey does not match known hosts (StrictHostKeyChecking:ask): "+chost);
        }
        insert = true;
      } else {
View Full Code Here

Examples of org.voltdb.compiler.DeploymentBuilder.UserInfo

            }
            assertTrue("Connecting bad user should have failed", threw);

            // Try to add a user with a new role to the system
            dbuilder.addUsers(new UserInfo[]
                    {new UserInfo("user", "user", new String[] {"NEWROLE"})});
            dbuilder.writeXML(pathToDeployment);
            threw = false;
            try {
                adminClient.updateApplicationCatalog(null, new File(pathToDeployment));
            }
View Full Code Here

Examples of org.voltdb.compiler.VoltProjectBuilder.UserInfo

        GroupInfo gi = new GroupInfo("foo", true, false, true, true, false, false);
        builder.addGroups(new GroupInfo[] { gi } );

        // create 20 users, only the first one has an interesting user/pass
        UserInfo[] ui = new UserInfo[15];
        ui[0] = new UserInfo("ry@nlikesthe", "y@nkees", new String[] { "foo" } );
        for (int i = 1; i < ui.length; i++) {
            ui[i] = new UserInfo("USER" + String.valueOf(i), "PASS" + String.valueOf(i), new String[] { "foo" } );
        }
        builder.addUsers(ui);

        builder.setSecurityEnabled(true);

        ProcedureInfo[] pi = new ProcedureInfo[2];
        pi[0] = new ProcedureInfo(new String[] { "foo" }, "Insert", "insert into HELLOWORLD values (?,?,?);", null);
        pi[1] = new ProcedureInfo(new String[] { "foo" }, "Select", "select * from HELLOWORLD;", null);
        builder.addProcedures(pi);

        builder.setHTTPDPort(8095);

        boolean success = builder.compile(Configuration.getPathToCatalogForTest("json.jar"));
        assertTrue(success);

        VoltDB.Configuration config = new VoltDB.Configuration();
        config.m_pathToCatalog = config.setPathToCatalogForTest("json.jar");
        config.m_pathToDeployment = builder.getPathToDeployment();
        server = new ServerThread(config);
        server.start();
        server.waitForInitialization();

        ParameterSet pset;

        // test good auths
        for (UserInfo u : ui) {
            pset = ParameterSet.fromArrayNoCopy(u.name, u.password, u.name);
            String response = callProcOverJSON("Insert", pset, u.name, u.password, true);
            Response r = responseFromJSON(response);
            assertEquals(ClientResponse.SUCCESS, r.status);
        }
        // test re-using auths
        for (UserInfo u : ui) {
            pset = ParameterSet.fromArrayNoCopy(u.name + "-X", u.password + "-X", u.name + "-X");
            String response = callProcOverJSON("Insert", pset, u.name, u.password, false);
            Response r = responseFromJSON(response);
            assertEquals(ClientResponse.SUCCESS, r.status);
        }

        // test bad auth
        UserInfo u = ui[0];
        pset = ParameterSet.fromArrayNoCopy(u.name + "-X1", u.password + "-X1", u.name + "-X1");
        String response = callProcOverJSON("Insert", pset, u.name, "ick", true);
        Response r = responseFromJSON(response);
        assertEquals(ClientResponse.UNEXPECTED_FAILURE, r.status);
        response = callProcOverJSON("Insert", pset, u.name, "ick", false);
        r = responseFromJSON(response);
        assertEquals(ClientResponse.UNEXPECTED_FAILURE, r.status);

        // test malformed auth (too short hash)
        pset = ParameterSet.fromArrayNoCopy(u.name + "-X2", u.password + "-X2", u.name + "-X2");
        String paramsInJSON = pset.toJSONString();
        HashMap<String,String> params = new HashMap<String,String>();
        params.put("Procedure", "Insert");
        params.put("Parameters", paramsInJSON);
        params.put("User", u.name);
        params.put("Password", Encoder.hexEncode(new byte[] {1,2,3}));
        String varString = getHTTPVarString(params);
        response = callProcOverJSONRaw(varString, 200);
        r = responseFromJSON(response);
        assertEquals(ClientResponse.UNEXPECTED_FAILURE, r.status);

        // test malformed auth (gibberish password, but good length)
        pset = ParameterSet.fromArrayNoCopy(u.name + "-X3", u.password + "-X3", u.name + "-X3");
        paramsInJSON = pset.toJSONString();
        params = new HashMap<String,String>();
        params.put("Procedure", "Insert");
        params.put("Parameters", paramsInJSON);
        params.put("User", u.name);
        params.put("Password", "abcdefghiabcdefghiabcdefghiabcdefghi");
        varString = getHTTPVarString(params);
        response = callProcOverJSONRaw(varString, 200);
        r = responseFromJSON(response);
        assertEquals(ClientResponse.UNEXPECTED_FAILURE, r.status);

        // the update catalog test below is for enterprise only
        if (VoltDB.instance().getConfig().m_isEnterprise == false) {
            return;
        }

        // ENG-963 below here
        // do enough to get a new deployment file
        VoltProjectBuilder builder2 = new VoltProjectBuilder();
        builder2.addSchema(schemaPath);
        builder2.addPartitionInfo("HELLOWORLD", "DIALECT");

        // Same groups
        builder2.addGroups(new GroupInfo[] { gi } );

        // create same 15 users, hack the last 14 passwords
        ui = new UserInfo[15];
        ui[0] = new UserInfo("ry@nlikesthe", "y@nkees", new String[] { "foo" } );
        for (int i = 1; i < ui.length; i++) {
            ui[i] = new UserInfo("USER" + String.valueOf(i),
                                 "welcomehackers" + String.valueOf(i),
                                 new String[] { "foo" } );
        }
        builder2.addUsers(ui);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.