Application access file.
- The application access file is JSON compliant file.
- It’s basically used for:
- To specify if the authentication is required to enable access to package content, which data is exposed.
- If rewrite rules are in place to hide target and source URLs.
- You can also specify if any level of authorization is required for the package and whether SSL is mandatory for client connections.
- How to create it?
- Open SAP HANA Studio.
- Open SAP HANA development Perspective.
- In the Project Explorer tab, right click on the folder where you want to create it.
- In context menu,
NewàOtheràSAP HANAàApplication DevelopmentàXS Application Access file.
- Finish it.
- Now open the .xsaccess file from project and edit it.
- How to create define access in .xsacess file.
- A basic .xsaccess file must, at the very least contain a set of curly bracket.
- The setting specified in an .xsaccess file apply not only to the package which contains .xsaccess file but also apply to sub-packages also.
- Multiple .xsaccess files are allowed but at different package hierarchy.
- You can’t put two .xsaccess file in the same package.
- Package without a dedicated .xsaccess file inherit the application-access setting defined in the parent folder.
- The .xsaccess file uses keyword-value pair to set access rules, if mandatory keyword-value pair is not set then the default value is assumed.
- Following keywords are used;
- To enable application to access
the data by HTTP to client request.
“exposed” : true (default – false) - To protect your application
against the attack that uses cross-site request forgery (XSRF) vector.
“prevent_xsrf” : true - To define the application
authentication method.
“authentication” : { “method”: “Form”} - To
specify if application privileges is required to a particular package.
(optional)
“authorization”:
[ “com.test::Execute”,
“com.test::Admin”
]
Note: If you use authorization keyword in the .xsaccess file then you must also create .xsprivileges file for the same application package or parent package. - The
anonymous_connection keyword enables you to define the name of the .xssqlcc
file that will be used for SQL access where no user credential is required.
"anonymous_connection" : "com.test::registration" - With
default_connection keyword, the specified SQL connection configuration (defined
in .xssqlcc) is used for all SQL execution in the package.
"default_connection":"com.test::registration"
Note:
The difference between anonymous_connection and default_connection is that the anonymous_connection is only used if the requesting user is not authenticated. - To
override the cache-control header for web content served by SAP HANA XS Web
Server.
"cache-control" :"no-store" - To
override the default setting for the application access(index.html) when the
package is accessed without providing a file in the URI.
"default_file" : "new_index.html" - To
hide the details of internal URL path from external users, clients, and search
engine.
URL re-write rules are written in source-target pair where the source is written in the java script regex syntax and the target is a simple string where reference to found group can be inserted using $groupnumber.
"rewrite_rules"
[ {
"source" : "go/zyd/dfdfd",
"target": "/test/new.xsjs"
}] - To
refuse the web-browser requests that do not use secure HTTP(SSL/HTTPS) for
client connection.
"force_ssl" : true
No comments:
Post a Comment