-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdddb64
commit a81305a
Showing
12 changed files
with
314 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ public enum PrincipalType { | |
JWT_SCOPE, | ||
JWT_ISSUER, | ||
JWT_SUBJECT, | ||
JWT_CLIENT, | ||
VO, | ||
FQAN, | ||
VO_MAP, | ||
|
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
56 changes: 56 additions & 0 deletions
56
src/main/java/org/italiangrid/storm/webdav/oauth/authority/JwtClientAuthority.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,56 @@ | ||
/** | ||
* Copyright (c) Istituto Nazionale di Fisica Nucleare, 2014-2023. | ||
* | ||
* 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.italiangrid.storm.webdav.oauth.authority; | ||
|
||
public class JwtClientAuthority extends JwtAuthority { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public static final String AUTH_TEMPLATE = "O_client(%s,%s)"; | ||
|
||
private final String clientId; | ||
|
||
public JwtClientAuthority(String issuer, String clientId) { | ||
super(issuer, String.format(AUTH_TEMPLATE, issuer, clientId)); | ||
this.clientId = clientId; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = super.hashCode(); | ||
result = prime * result + ((clientId == null) ? 0 : clientId.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (!super.equals(obj)) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
JwtClientAuthority other = (JwtClientAuthority) obj; | ||
if (clientId == null) { | ||
if (other.clientId != null) | ||
return false; | ||
} else if (!clientId.equals(other.clientId)) | ||
return false; | ||
return true; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
server: | ||
jetty: | ||
accesslog: | ||
enabled: false | ||
|
||
management: | ||
endpoints: | ||
web: | ||
exposure: | ||
include: env | ||
|
||
oauth: | ||
enable-oidc: false | ||
issuers: | ||
- name: iam-dev | ||
issuer: https://iam-dev.cloud.cnaf.infn.it/ | ||
|
||
storm: | ||
connector: | ||
port: 8086 | ||
securePort: 9443 | ||
sa: | ||
config-dir: src/test/resources/conf/sa.d | ||
tls: | ||
trust-anchors-dir: src/test/resources/trust-anchors | ||
certificate-path: src/test/resources/hostcert/hostcert.pem | ||
private-key-path: src/test/resources/hostcert/hostkey.pem | ||
authz-server: | ||
enabled: true | ||
voms: | ||
trust-store: | ||
dir: src/test/resources/vomsdir | ||
tape: | ||
well-known: | ||
source: src/test/resources/well-known/wlcg-tape-rest-api.json | ||
|
||
authz: | ||
policies: | ||
- sa: fga | ||
actions: | ||
- all | ||
effect: permit | ||
description: Grant read/write access to a specific client | ||
paths: | ||
- /** | ||
principals: | ||
- type: jwt-client | ||
params: | ||
iss: https://iam-dev.cloud.cnaf.infn.it/ | ||
id: 42999a63-7449-43fb-952e-42f2d75b865b | ||
|
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.