mvn archetype:generate "-DarchetypeGroupId=com.sap.cloud.sdk.archetypes" "-DarchetypeArtifactId=scp-cf-tomee" "-DarchetypeVersion=RELEASE"
mvn clean package
cd application && mvn tomee:run
cd .. && cf push
$ sap-cloud-sdk add-approuter
No 'manifest.yml' found.
Enter project name as maintained in Cloud Foundry: test-sec
Creating files
Successfully added approuter to your project.
Generated files might need customization. Documentation available here:
- xs-security.json (for help check https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.02/en-US/e6fc90df44464a29952e1c2c36...
- xs-app.json (for help check https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/c103fb414988447ead2023f7680...
- mainfest.yml (for help check https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/ba527058dc4d423a9e0a69ecc67...
$ ls approuter -al
total 28
drwxr-xr-x 2 i348221 i348221 4096 Apr 30 11:46 .
drwxr-xr-x 14 i348221 i348221 4096 Apr 30 11:46 ..
-rw-r--r-- 1 i348221 i348221 448 Apr 30 11:46 manifest.yml
-rw-r--r-- 1 i348221 i348221 87 Apr 30 11:46 .npmrc
-rw-r--r-- 1 i348221 i348221 158 Apr 30 11:46 package.json
-rw-r--r-- 1 i348221 i348221 123 Apr 30 11:46 xs-app.json
-rw-r--r-- 1 i348221 i348221 57 Apr 30 11:46 xs-security.json
@sap:registry=https://npm.sap.com/
{
"xsappname": "test-sec",
"tenant-mode": "dedicated"
}
cf create-service xsuaa application test-sec-xsuaa -c xs-security.json
$ cf services
name service plan bound apps last operation broker upgrade available
abap abap-trial shared create succeeded sm-abap-trial-broker-3e22f640-a893-497a-a56a-01d090a4cbb7
test-sec-xsuaa xsuaa application create succeeded sm-xsuaa-9ef36350-f975-4194-a399-54db361e79b5
$ cf service test-sec-xsuaa
name: test-sec-xsuaa
service: xsuaa
tags:
plan: application
description: Manage application authorizations and trust to identity providers.
documentation: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/6373bb7a96114d619bfdfdc6f50...
dashboard:
service broker: sm-xsuaa-9ef36350-f975-4194-a399-54db361e79b5
Showing status of last operation from service test-sec-xsuaa...
status: create succeeded
message:
started: 2020-04-30T02:59:02Z
updated: 2020-04-30T02:59:02Z
There are no bound apps for this service.
cf bind-service test-sec test-sec-xsuaa
cf bind-service test-sec test-sec-xsuaa -c xs-security.json
cf restage test-sec
cf create-route dev cfapps.eu10.hana.ondemand.com --hostname <App Routerのホスト名>
applications:
- name: test-sec-approuter
routes:
- route:
https://<2.3で作成したRouteのホスト名>.<2.3で作成したRouteのドメイン名>;
path: .
memory: 128M
buildpacks:
- nodejs_buildpack
env:
# TENANT_HOST_PATTERN: >-
# "test-sec-(.*).cfapps.sap.hana.ondemand.com"
destinations: >-
[{"name":"test-sec","url":"https://<1で作成したJavaのホスト・ドメイン名>","forwardAuthToken":true}]
services:
- test-sec-xsuaa
cf push
---
applications:
- name: test-sec
memory: 1024M
timeout: 300
random-route: false
routes:
- route:
https://<1でランダムに登録されたRoute>;
path: application/target/test-sec-application.war
buildpacks:
- sap_java_buildpack
env:
TARGET_RUNTIME: tomee7
SET_LOGGING_LEVEL: '{ROOT: INFO, com.sap.cloud.sdk: INFO}'
JBP_CONFIG_SAPJVM_MEMORY_SIZES: 'metaspace:128m..'
services:
# - my-application-logs
- test-sec-xsuaa
# - my-destination
# - my-connectivity
<login-config>
<auth-method>XSUAA</auth-method>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Baseline Security</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>Display</role-name>
</security-role>
package com.sap.cloud.sdk;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.ServletSecurity;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/hello")
@ServletSecurity(@HttpConstraint(rolesAllowed = { "Display" }))
public class HelloWorldServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(HelloWorldServlet.class);
@Override
protected void doGet( final HttpServletRequest request, final HttpServletResponse response )
throws IOException
{
logger.info("I am running!");
response.getWriter().write("Hello World!");
}
}
# From Application Directory
mvn clean package
# move to Root Directory and push
cd .. && cf push
{
"xsappname": "test-sec",
"tenant-mode": "dedicated",
"scopes": [
{
"name": "$XSAPPNAME.Display",
"description": "display"
}
],
"role-templates": [
{
"name": "Viewer",
"description": "Required to view things in our solution",
"scope-references" : [
"$XSAPPNAME.Display"
]
}
]
}
cf update-service test-sec-xsuaa -c xs-security.json
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
24 | |
10 | |
8 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 |