Examples of Authorization


Examples of com.github.zhangkaitao.shiro.chapter23.entity.Authorization

    @RequiresPermissions("authorization:create")
    @RequestMapping(value = "/create", method = RequestMethod.GET)
    public String showCreateForm(Model model) {
        setCommonData(model);
        Authorization authorization = new Authorization();
        model.addAttribute("authorization", authorization);
        model.addAttribute("op", "新增");
        return "authorization/edit";
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter23.entity.Authorization

    public Authorization updateAuthorization(Authorization authorization) {
        return merge(authorization);
    }

    public Authorization merge(Authorization authorization) {
        Authorization dbAuthorization = authorizationDao.findByAppUser(authorization.getAppId(), authorization.getUserId());
        if(dbAuthorization ==  null) {//如果数据库中不存在相应记录 直接新增
            return authorizationDao.createAuthorization(authorization);
        }

        if(dbAuthorization.equals(authorization)) {//如果是同一条记录直接更新即可
            return authorizationDao.updateAuthorization(authorization);
        }

        for(Long roleId : authorization.getRoleIds()) {//否则合并
            if(!dbAuthorization.getRoleIds().contains(roleId)) {
                dbAuthorization.getRoleIds().add(roleId);
            }
        }

        if(dbAuthorization.getRoleIds().isEmpty()) {//如果没有角色 直接删除记录即可
            authorizationDao.deleteAuthorization(dbAuthorization.getId());
            return dbAuthorization;
        }
        //否则更新
        return authorizationDao.updateAuthorization(dbAuthorization);
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter23.entity.Authorization

        }
        Long appId = appService.findAppIdByAppKey(appKey);
        if(appId == null) {
            return Collections.EMPTY_SET;
        }
        Authorization authorization = authorizationDao.findByAppUser(appId, user.getId());
        if(authorization == null) {
            return Collections.EMPTY_SET;
        }
        return roleService.findRoles(authorization.getRoleIds().toArray(new Long[0]));
    }
View Full Code Here

Examples of com.github.zhangkaitao.shiro.chapter23.entity.Authorization

        }
        Long appId = appService.findAppIdByAppKey(appKey);
        if(appId == null) {
            return Collections.EMPTY_SET;
        }
        Authorization authorization = authorizationDao.findByAppUser(appId, user.getId());
        if(authorization == null) {
            return Collections.EMPTY_SET;
        }
        return roleService.findPermissions(authorization.getRoleIds().toArray(new Long[0]));
    }
View Full Code Here

Examples of com.sshtools.common.configuration.Authorization

* @throws IOException
* @throws InvalidSshKeyException
*/
    public byte[] format(AuthorizedKeys keys, AuthorizedKeysFileSaver saver)
        throws IOException, InvalidSshKeyException {
        Authorization authorization = new Authorization();
        SshPublicKeyFile pubfile;
        SECSHPublicKeyFormat secsh = new SECSHPublicKeyFormat();
        Map.Entry entry;

        for (Iterator it = keys.getAuthorizedKeys().entrySet().iterator();
                (it != null) && it.hasNext();) {
            entry = (Map.Entry) it.next();

            // Write out the public key file
            String username = (String) entry.getValue();
            String filename = username + ".pub";
            secsh.setComment(username);
            pubfile = SshPublicKeyFile.create((SshPublicKey) entry.getKey(),
                    secsh);
            saver.saveFile(filename, pubfile.toString().getBytes("US-ASCII"));

            // Write out the key entry
            authorization.addKey(filename);
        }

        return authorization.toString().getBytes("US-ASCII");
    }
View Full Code Here

Examples of com.wordnik.swagger.model.Authorization

                AuthorizationScope[] authorizationScopes = new AuthorizationScope[authorization.scopes().length];
                for(int i = 0;i < authorization.scopes().length;i++) {
                    com.wordnik.swagger.annotations.AuthorizationScope authScope = authorization.scopes()[i];
                    authorizationScopes[i] = new AuthorizationScope(authScope.scope(), authScope.description());
                }
                this.authorizations.add(new Authorization(authorization.value(), authorizationScopes));
            }
        }
View Full Code Here

Examples of facebook4j.auth.Authorization

        @Test
        public void nulls() throws Exception {
            RequestMethod method = RequestMethod.GET;
            String url = "https://graph.facebook.com/foo/bar";
            HttpParameter[] parameters = null;
            Authorization authorization = null;
            Map<String, String> requestHeaders = null;

            HttpRequest actual = new HttpRequest(method, url, parameters, authorization, requestHeaders);
            assertThat(actual.getMethod(), is(RequestMethod.GET));
            assertThat(actual.getURL(), is("https://graph.facebook.com/foo/bar"));
View Full Code Here

Examples of gov.nist.javax.sip.header.Authorization

                to.setTag(this.hisTag);
            sipRequest.setTo(to);
            sipRequest.setMaxForwards(new MaxForwards(70));

            if (this.originalRequest != null) {
                Authorization authorization = this.originalRequest.getAuthorization();
                if (authorization != null)
                    sipRequest.setHeader(authorization);
            }

            // ACKs for 2xx responses
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Authorization

        /**
         * Required by table model interface.
         */
        public Object getValueAt(int row, int column) {
            Authorization auth = manager.getAuthObjectAt(row);

            switch (column){
                case AuthManager.COL_URL:
                    return auth.getURL();
                case AuthManager.COL_USERNAME:
                    return auth.getUser();
                case AuthManager.COL_PASSWORD:
                    return auth.getPass();
                case AuthManager.COL_DOMAIN:
                    return auth.getDomain();
                case AuthManager.COL_REALM:
                    return auth.getRealm();
                default:
                    return null;
            }
        }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Authorization

            }
        }

        @Override
        public void setValueAt(Object value, int row, int column) {
            Authorization auth = manager.getAuthObjectAt(row);
            log.debug("Setting auth value: " + value);
            switch (column){
                case AuthManager.COL_URL:
                    auth.setURL((String) value);
                    break;
                case AuthManager.COL_USERNAME:
                    auth.setUser((String) value);
                    break;
                case AuthManager.COL_PASSWORD:
                    auth.setPass((String) value);
                    break;
                case AuthManager.COL_DOMAIN:
                    auth.setDomain((String) value);
                    break;
                case AuthManager.COL_REALM:
                    auth.setRealm((String) value);
                    break;
                default:
                    break;
            }
        }
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.