我在我的os x 10.10上更新了docker,所以它现在使用os x本机虚拟化.但是,我发现从我的nginx容器中连接到我的主机很棘手.我试过这个:
/sbin/ip route|awk '/default/ { print $3 }'
得到了答案:
172.17.0.1
然后我在docker-compose.yml中使用了这个ip:
extra_hosts:
- "master:172.17.0.1"
Run Code Online (Sandbox Code Playgroud)
但是我仍然遇到错误:
172.17.0.1 - - [21/Jul/2016:09:33:46 +0000] "GET /api HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
2016/07/21 09:33:46 [error] 7#7: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.17.0.1, server: soc-credit.ru, request: "GET /api HTTP/1.1", upstream: "http://172.17.0.5:8080/api", host: "localhost"
请注意这部分:client: 172.17.0.1.由于我已经从主机发出请求,它证明我在第一步获得的ip是正确的.但无论如何都没有建立联系.
我想强调一下,我在连接FROM WITHIN容器到主机时遇到问题,反之亦然.
我究竟做错了什么?谢谢!
我需要将身份验证添加到我的 Spring Boot (MVC) 应用程序中。身份验证提供者是通过 OpenID 的 keycloak。隐式授予和授权代码授予均被禁用,因此我只能使用资源所有者凭据授予。我想要实现的是针对未经授权的用户的基本身份验证提示。以这种方式检索到的凭证应用于从 keycloak 获取令牌和用户信息,以便 spring security 进一步使用。应在每个请求时检查令牌。
我发现的大多数示例都使用org.keycloak:keycloak-spring-boot-starter. enable-basic-auth 虽然我在这里找到了,但它对我不起作用。我知道我必须使用它keycloak.bearer-only=true来关闭重定向,但它可以正常工作,因此它不会为未经授权的用户返回 401,而是返回 401。
我的安全配置:
@Configuration
@EnableWebSecurity
@ComponentScan(basePackageClasses = KeycloakSecurityComponents.class)
public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
@Bean
public KeycloakSpringBootConfigResolver KeycloakConfigResolver() {
return new KeycloakSpringBootConfigResolver();
}
@Override
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().permitAll();
}
}
Run Code Online (Sandbox Code Playgroud)
我的 keycloak 属性(我不使用占位符,这只是为了安全起见):
keycloak.auth-server-url=https://${keycloak.host}/auth/
keycloak.realm=master
keycloak.resource=${client.name}
keycloak.enable-basic-auth=true
keycloak.credentials.secret=${client.secret}
Run Code Online (Sandbox Code Playgroud)
很抱歉问这个一般性问题。我主要使用 jdbcAuthentication,这是我第一次使用身份管理软件。
我很好奇,是否有任何官方代码指南或Oracle PL/SQL中的代码格式约定?
所以,我下载并安装了STS,然后我创建了一个新的Spring MVC项目.在那之后,sts提醒我22个问题,这里是:
Description Resource Path Location Type
Missing artifact aopalliance:aopalliance:jar:1.0 pom.xml /ContactManager line 1 Maven Dependency Problem
Missing artifact org.springframework:spring-beans:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem
Missing artifact org.springframework:spring-context:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem
Missing artifact org.springframework:spring-aop:jar:3.1.1.RELEASE pom.xml /ContactManager line 1 Maven Dependency Problem
ArtifactDescriptorException: Failed to read artifact descriptor for org.slf4j:slf4j-api:jar:1.6.6: ArtifactResolutionException: Failure to transfer org.slf4j:slf4j-api:pom:1.6.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has …Run Code Online (Sandbox Code Playgroud) 我有一个可观察的对象数组
question = {
ownerUserName: item.id,
text: item.text,
dataType: item.dataType,
personalized: item.personalized,
status: item.status,
actionUserName: item.actionUserName
}
Run Code Online (Sandbox Code Playgroud)
以及来自此数组的选项:
<select id="questId" style="width: 425px" data-bind="options: questionList, optionsText: 'text'">
Run Code Online (Sandbox Code Playgroud)
如何在淘汰赛的帮助下如果问题.个性化=="Y"这个问题的文字颜色会是绿色吗?
我一直在尝试这个Spring社交访问Twitter数据指南.虽然我已经加倍,三倍,所以当我点击"连接到Twitter"按钮时,我一直收到此错误:
POST request for "https://api.twitter.com/oauth/request_token" resulted in 401 (Authorization Required); invoking error handler
这是我的代码:
src/main/resources/templates/connect/twitterConnect.html
<html>
<head>
<title>Hello Twitter</title>
</head>
<body>
<h3>Connect to Twitter</h3>
<form action="/connect/twitter" method="POST">
<div class="formInfo">
<p>You aren't connected to Twitter yet. Click the button to connect this application with your Twitter account.</p>
</div>
<p><button type="submit">Connect to Twitter</button></p>
</form>
</body>
Run Code Online (Sandbox Code Playgroud)
src/main/resources/templates/connect/twitterConnected.html
<html>
<head>
<title>Hello Twitter</title>
</head>
<body>
<h3>Connected to Twitter</h3>
<p>
You are now connected to your Twitter account.
Click <a href="/">here</a> to see your …Run Code Online (Sandbox Code Playgroud) 我想了解淘汰赛.有一件事我不明白.我们有html:
<p>
<input type='checkbox' data-bind="checked: hasCellphone" />
I have a cellphone</p>
<p>
Your cellphone number:
<input type='text' name='cell' data-bind="value: cellphoneNumber, enable: hasCellphone" /></p>
<button data-bind="enable: document.getElementsByName("cell")[0].value != '555'">
Do something</button>
Run Code Online (Sandbox Code Playgroud)
和JS:
function AppViewModel() {
this.hasCellphone = ko.observable(false);
this.cellphoneNumber = ko.observable("");}
ko.applyBindings(new AppViewModel());
Run Code Online (Sandbox Code Playgroud)
因此,启用输入工作,但不启用按钮,即使我在输入中输入"555"它仍然保持启用状态.
javascript ×2
knockout.js ×2
docker ×1
eclipse ×1
html ×1
java ×1
keycloak ×1
macos ×1
maven ×1
oracle ×1
oracle11g ×1
plsql ×1
spring ×1
spring-boot ×1
spring-mvc ×1
twitter ×1