Merge pull request #2602 from stianst/KEYCLOAK-2810
KEYCLOAK-2810 Added robots.txt and robots meta header
This commit is contained in:
commit
794c4bc5f1
8 changed files with 56 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
<head>
|
||||
<title>Welcome to Keycloak</title>
|
||||
<meta http-equiv="refresh" content="0; url=/auth/" />
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow: /
|
|
@ -81,6 +81,7 @@ public class KeycloakApplication extends Application {
|
|||
context.setAttribute(KeycloakSessionFactory.class.getName(), this.sessionFactory);
|
||||
|
||||
singletons.add(new ServerVersionResource());
|
||||
singletons.add(new RobotsResource());
|
||||
singletons.add(new RealmsResource());
|
||||
singletons.add(new AdminRoot());
|
||||
classes.add(ThemeResource.class);
|
||||
|
|
36
services/src/main/java/org/keycloak/services/resources/RobotsResource.java
Executable file
36
services/src/main/java/org/keycloak/services/resources/RobotsResource.java
Executable file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.services.resources;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
@Path("/robots.txt")
|
||||
public class RobotsResource {
|
||||
|
||||
private static final String robots = "User-agent: *\n" + "Disallow: /";
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public String getRobots() {
|
||||
return robots;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
|
||||
<title>${msg("accountManagementTitle")}</title>
|
||||
<link rel="icon" href="${url.resourcesPath}/img/favicon.ico">
|
||||
<#if properties.styles?has_content>
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="shortcut icon" href="${resourceUrl}/img/favicon.ico">
|
||||
<#if properties.styles?has_content>
|
||||
<#list properties.styles?split(' ') as style>
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" class="${properties.kcHtmlClass!}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
|
||||
<#if properties.meta?has_content>
|
||||
<#list properties.meta?split(' ') as meta>
|
||||
<meta name="${meta?split('==')[0]}" content="${meta?split('==')[1]}"/>
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Welcome to Keycloak</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
|
||||
<link rel="shortcut icon" href="welcome-content/favicon.ico" type="image/x-icon">
|
||||
<link rel="StyleSheet" href="welcome-content/keycloak.css" type="text/css">
|
||||
<style>
|
||||
|
|
Loading…
Reference in a new issue