Skip to content

Commit

Permalink
AUTH-32 add header
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Feb 16, 2022
1 parent 72532fa commit 45fe47d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -64,6 +64,8 @@ public DataContainer getData(Site site, Application application, Environment env
dataContainer.getSelections().add(langSelection);
}
dataContainer.setItem(new LoginData());
((DefaultEnvironment) environment).getServletResponse()
.setHeader(com.google.common.net.HttpHeaders.CONTENT_SECURITY_POLICY, "frame-ancestors 'none'");
return dataContainer;
}

Expand Down
Expand Up @@ -31,6 +31,8 @@
import org.springframework.http.HttpStatus;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.net.HttpHeaders;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LoginUserTest extends BaseLoginTest {

Expand Down Expand Up @@ -61,7 +63,10 @@ public void testLoginOK() throws Exception {

Mockito.verify(site).sendRedirect(Mockito.eq(environment), Mockito.eq("/manager/appng/appng-manager"),
Mockito.eq(HttpStatus.FOUND.value()));
((DefaultEnvironment) environment).logoutSubject();
DefaultEnvironment defaultEnv = (DefaultEnvironment) environment;
defaultEnv.logoutSubject();
Assert.assertEquals("frame-ancestors 'none'",
defaultEnv.getServletResponse().getHeader(HttpHeaders.CONTENT_SECURITY_POLICY));
}

@Test
Expand Down

0 comments on commit 45fe47d

Please sign in to comment.