コード例 #1
0
        private SecurityConfiguration(JsonObject value, ConfigurationService configurationService)
        {

            _identifier = value.GetString("identifier");
            _configurationService = configurationService;

            _clients = new Dictionary<string, Subject>();
            _servers = new Dictionary<string, Subject>();


            { // subjects
                JsonArray registeredSubjects = value.GetJsonArray("subjects");

                for (int i = 0, count = registeredSubjects.Count(); i < count; i++)
                {
                    JsonObject subjectData = registeredSubjects.GetJsonObject(i);

                    String subjectIdentifier = subjectData.GetString("identifier");
                    String subjectPassword = subjectData.GetString("password");
                    String subjectLabel = subjectData.GetString("label");

                    this.addSubject(subjectIdentifier, subjectPassword, subjectLabel);
                }
            }

        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////
        //
        private SecurityConfiguration(String identifier, ConfigurationService configurationService)
        {
            _identifier = identifier;
            _configurationService = configurationService;

            _clients = new Dictionary<string, Subject>();
            _servers = new Dictionary<string, Subject>();

        }
コード例 #3
0
        public static SecurityConfiguration build(SecurityAdapter identifierProvider, ConfigurationService configurationService)
        {
            JsonObject bundleData = configurationService.getBundle(SimpleSecurityAdapter.BUNDLE_NAME);

            SecurityConfiguration answer = null;

            if (null != bundleData)
            {
                if (bundleData.Contains("identifier"))
                {
                    answer = new SecurityConfiguration(bundleData, configurationService);
                    return answer;
                }
            }

            String identifer = identifierProvider.getIdentifier();
            log.debug(identifer, "identifer");

            answer = new SecurityConfiguration(identifer, configurationService);
            answer.save(); // ensure we persist the newly created 'identifer'

            return answer;
        }