-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add last_used property to clients (#675)
* Add table CLIENT_LAST_USED * Add last used column on dashboard clients table * Add TOKEN event to IamAuditApplicationEvent and publish AccessTokenIssuedEvent and AccessTokenRefreshedEvent * Hide column on dashboard when tracking disabled * Enable the tracking by default
- Loading branch information
1 parent
d52941f
commit ddcc4c2
Showing
19 changed files
with
401 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ogin-service/src/main/java/it/infn/mw/iam/audit/events/tokens/AccessTokenIssuedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021 | ||
* | ||
* 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 it.infn.mw.iam.audit.events.tokens; | ||
|
||
import org.mitre.oauth2.model.OAuth2AccessTokenEntity; | ||
|
||
|
||
public class AccessTokenIssuedEvent extends TokenEvent { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public AccessTokenIssuedEvent(Object source, OAuth2AccessTokenEntity token) { | ||
super(source, token, "Access token issued"); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...n-service/src/main/java/it/infn/mw/iam/audit/events/tokens/AccessTokenRefreshedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021 | ||
* | ||
* 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 it.infn.mw.iam.audit.events.tokens; | ||
|
||
import org.mitre.oauth2.model.OAuth2AccessTokenEntity; | ||
|
||
|
||
public class AccessTokenRefreshedEvent extends TokenEvent { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public AccessTokenRefreshedEvent(Object source, OAuth2AccessTokenEntity token) { | ||
super(source, token, "Access token refreshed"); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
iam-login-service/src/main/java/it/infn/mw/iam/audit/events/tokens/TokenEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2016-2021 | ||
* | ||
* 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 it.infn.mw.iam.audit.events.tokens; | ||
|
||
import java.util.Date; | ||
import java.util.Set; | ||
|
||
import org.mitre.oauth2.model.OAuth2AccessTokenEntity; | ||
|
||
import it.infn.mw.iam.audit.events.IamAuditApplicationEvent; | ||
|
||
public abstract class TokenEvent extends IamAuditApplicationEvent { | ||
private static final long serialVersionUID = 1L; | ||
private final Date expiration; | ||
private final String clientId; | ||
private final Set<String> scopes; | ||
|
||
public TokenEvent(Object source, OAuth2AccessTokenEntity token, String message) { | ||
super(IamEventCategory.TOKEN, source, message); | ||
this.expiration = token.getExpiration(); | ||
this.clientId = token.getClient().getClientId(); | ||
this.scopes = token.getScope(); | ||
} | ||
|
||
public Date getExpiration() { | ||
return expiration; | ||
} | ||
|
||
public String getClientId() { | ||
return clientId; | ||
} | ||
|
||
public Set<String> getScopes() { | ||
return scopes; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.