C++: add method to authorization, auth method classes added to
authorjani <jani@asema.com>
Sat, 20 Jul 2019 17:11:54 +0000 (20:11 +0300)
committerjani <jani@asema.com>
Sat, 20 Jul 2019 17:11:54 +0000 (20:11 +0300)
SecurityOntology

Common/C++/SmartAPI/smartapi/common/RESOURCE.h
Common/C++/SmartAPI/smartapi/model/Authorization.cpp
Common/C++/SmartAPI/smartapi/model/Authorization.h
Common/C++/SmartAPI/smartapi/model/Evaluation.cpp
Ontology/src/1.0/SecurityOntology-1.0.ttl

index e6f710d7abb8da44271afd51bd71a635f3d44b82..75f6a4bb0ab802a5cd53dec3842e1863b2ce3b3a 100644 (file)
 #define RESOURCE__ZONETRAVELDEPENDENTPRICESPECIFICATION                "http://smart-api.io/ontology/1.0/smartapi#ZoneTravelDependentPriceSpecification"
 #define RESOURCE__ZONETRAVELDURATIONDEPENDENTPRICESPECIFICATION                "http://smart-api.io/ontology/1.0/smartapi#ZoneTravelDurationDependentPriceSpecification"
 
+#define RESOURCE__COOKIE               "http://smart-api.io/ontology/1.0/smartapi#Cookie"
+#define RESOURCE__HTTPSTANDARD         "http://smart-api.io/ontology/1.0/smartapi#HttpStandard"
+#define RESOURCE__OAUTH2               "http://smart-api.io/ontology/1.0/smartapi#OAuth2"
+
 #endif //__RESOURCE_H__
index a699945760e657714cb53ddc5b3bd74435322d4a..8351b0c33383d9d9f5b692b2c2d9037b24831222 100755 (executable)
@@ -7,6 +7,7 @@ Authorization::Authorization(QString uri)
        : Obj(uri)
 {
        INIT_PROPERTY(mPerson)
+       INIT_PROPERTYLIST(mMethods, PROPERTY__METHOD);
        setType(RESOURCE__AUTHORIZATION);
 }
 
@@ -14,6 +15,7 @@ Authorization::Authorization(QString uri)
 Authorization::Authorization(Authorization* l) : Obj(l)
 {
        SET_PROPERTY_REFERENCE(PROPERTY__PERSON, mPerson, Person)
+       SET_PROPERTYLIST_REFERENCE(PROPERTY__METHOD, mMethods, Variant)
        setType(RESOURCE__AUTHORIZATION);
 }
 
@@ -36,6 +38,7 @@ Resource* Authorization::serialize(Model* model)
 void Authorization::parse(Statement* statement)
 {
        INIT_PARSE(statement)
+       PARSE_PROPERTY(PROPERTY__METHOD, addMethod, Variant)
        PARSE_PROPERTY(PROPERTY__PERSON, setPerson, Person)
        FINISH_PARSE(Obj)
 }
index b550d164102b12be664d2ab7845da4c982ecbf99..6d57bddc710b1cc230e13c41f22c6530dfd73ed0 100644 (file)
@@ -24,7 +24,14 @@ public:
        Person* getPerson()                                                     { return mPerson; }
        void setPerson(Person* p);
 
+       bool hasMethod()                                                        { return (mMethods.length() > 0); }
+       PropertyList<Variant*> getMethods()                     { return mMethods; }
+       void addMethod(QString method)                          { addMethod(new Variant(QUrl(method))); }
+       void addMethod(QUrl method)                                     { addMethod(new Variant(method)); }
+       void addMethod(Variant* method)                         { mMethods.append(method); }
+
 private:
+       PropertyList<Variant*> mMethods;
        Person* mPerson;
 };
 
index 253d85f0b22bda838c2eba8653616cd07e5bb4c3..3f626fd48b73c323aa0c34e16c4fc3f4995fcda8 100755 (executable)
@@ -24,7 +24,7 @@ Evaluation::Evaluation(QString uri)
 
        INIT_PROPERTY(mSystemOfInterest);
        INIT_PROPERTY(mMethod);
-       INIT_PROPERTYLIST(mTimeSeries,PROPERTY__TIMESERIES);
+       INIT_PROPERTYLIST(mTimeSeries, PROPERTY__TIMESERIES);
 }
 
 Evaluation::Evaluation(Evaluation* o) : ValueObject(o)
index 6c39846f7125367f469f51480399ef05d9e657b2..856d2eba735bf534525705209c51229f691a2bd0 100644 (file)
@@ -156,3 +156,21 @@ smartapi:authorization a owl:ObjectProperty ;
   rdfs:range smartapi:Authorization ;
   rdfs:isDefinedBy smartapi:SecurityOntology .
 
+smartapi:Cookie a owl:Class ;
+  rdfs:label "Cookie"@en ;
+  rdfs:comment "A security cookie."@en ;
+  rdfs:isDefinedBy smartapi:SecurityOntology ;
+  vs:term_status "testing".
+
+smartapi:OAuth2 a owl:Class ;
+  rdfs:label "OAuth2"@en ;
+  rdfs:comment "Authentication via OAuth2 standard."@en ;
+  rdfs:isDefinedBy smartapi:SecurityOntology ;
+  vs:term_status "testing".
+  
+smartapi:HttpStandard a owl:Class ;
+  rdfs:label "HTTP Standard"@en ;
+  rdfs:comment "Authentication via HTTP Standard authentication."@en ;
+  rdfs:isDefinedBy smartapi:SecurityOntology ;
+  vs:term_status "testing".
+  
\ No newline at end of file