Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove frontend code to delete spcp cookie #2551

Merged
merged 2 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/app/config/features/spcp-myinfo.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type ISpcpConfig = {
spCookieMaxAge: number
spCookieMaxAgePreserved: number
spcpCookieDomain: string
oldSpcpCookieDomain: string // TODO (#2329): To remove after old cookies have expired
cpCookieMaxAge: number
spIdpId: string
cpIdpId: string
Expand Down Expand Up @@ -84,13 +83,6 @@ const spcpMyInfoSchema: Schema<ISpcpMyInfo> = {
default: '',
env: 'SPCP_COOKIE_DOMAIN',
},
oldSpcpCookieDomain: {
// TODO (#2329): To remove after old cookies have expired
doc: 'Old domain name set on cookie that holds the SPCP jwt',
format: String,
default: '',
env: 'OLD_SPCP_COOKIE_DOMAIN',
},
cpCookieMaxAge: {
doc: 'Max CorpPass cookie age',
format: 'int',
Expand Down
3 changes: 0 additions & 3 deletions src/app/loaders/express/locals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const frontendVars = {
myInfoBannerContent: spcpMyInfoConfig.myInfoBannerContent, // MyInfo maintenance message
GATrackingID: googleAnalyticsConfig.GATrackingID,
spcpCookieDomain: spcpMyInfoConfig.spcpCookieDomain, // Cookie domain used for removing spcp cookies
oldSpcpCookieDomain: spcpMyInfoConfig.oldSpcpCookieDomain, // Old cookie domain used for backward compatibility. TODO (#2329): Delete env var
}
const environment = ejs.render(
`
Expand All @@ -45,8 +44,6 @@ const environment = ejs.render(
var formsgSdkMode = "<%= formsgSdkMode%>"
// SPCP Cookie
var spcpCookieDomain = "<%= spcpCookieDomain%>"
// Old SPCP Cookie
var oldSpcpCookieDomain = "<%= oldSpcpCookieDomain%>"
`,
frontendVars,
)
Expand Down
12 changes: 0 additions & 12 deletions src/public/modules/forms/services/spcp-session.client.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ function SpcpSession($interval, $q, Toastr, $window, $cookies) {
userName: null,
rememberMe: null,
issuedAt: null,
cookieNames: {
SP: 'jwtSp',
CP: 'jwtCp',
SGID: 'jwtSgid',
},
setUser: function ({ userName, rememberMe, iat, exp }) {
session.userName = userName
session.rememberMe = rememberMe
Expand All @@ -40,13 +35,6 @@ function SpcpSession($interval, $q, Toastr, $window, $cookies) {
session.userName = undefined
},
logout: function (authType) {
$cookies.remove(
// TODO (#2329): To remove after old cookies have expired
session.cookieNames[authType],
tshuli marked this conversation as resolved.
Show resolved Hide resolved
$window.oldSpcpCookieDomain
? { domain: $window.oldSpcpCookieDomain }
: {},
)
$q.when(PublicFormAuthService.logoutOfSpcpSession(authType))
.then(() => {
$cookies.put('isJustLogOut', true)
Expand Down