Skip to content

Commit 095efc2

Browse files
author
Jenkins CI
committed
Merge branch 'dev'
2 parents 1c9cc5e + 34e360e commit 095efc2

File tree

231 files changed

+6558
-1362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+6558
-1362
lines changed

documentation/src/main/doc/endpoint-oauth.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,15 @@ scope="openid profile read-tasks"
185185
==== Revocation and logout
186186

187187
The path +/revoke+ can be used to revoke an access token which was previously issued. This endpoint
188-
is implemented according to the RFC 7009, with the following Unity specifics:
188+
is implemented according to the RFC 7009. Only access and refresh tokens can be revoked using this endpoint.
189189

190-
. The +token_type_hint+ is a mandatory argument, must be always provided (in RFC it is optional). THe allowed values
191-
are +access_token+ and +refresh_token+.
192-
. The endpoint access is not authenticated - or better said the access is authorized implicitly by providing
193-
a valid token to be revoked. The +client_id+ must be always given.
194-
195-
Typical usage:
190+
Note that this endpoint has different requirements depending on whether the client is public or confidential. For
191+
public clients +client_id+ parameter is mandatory but client authentication is not needed. For confidential clients
192+
+client_id+ is not mandatory but client authentication is mandatory. See RFC for details. Note also that Unity offers
193+
a configuration option to allow for unauthenticated access for confidential clients. This option is for backwards
194+
compatibility (pre 3.7.0 release) when authentication was not required for all types of clients.
195+
196+
Typical usage (public client case):
196197

197198
----
198199
POST /.../revoke HTTP/1.1

documentation/src/main/rest-api/rest-api-v1.txt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,4 +1289,37 @@ then any token can be removed, otherwise it is allowed for removing owned tokens
12891289
Triggers sending user notification of the given message template. Request may use additional, variable, query parameters
12901290
which are used as template parameters. All such parameters should have the +custom.+ prefix (which is mandatory
12911291
in message template for custom properties).
1292-
1292+
1293+
=== Get idp usage statistics
1294+
1295+
+@Path("/idp-stats")+ +
1296+
+@GET+ +
1297+
+@QueryParam("since")+ +
1298+
+@QueryParam("groupBy")+ +
1299+
+@QueryParam("skipZeroRecords")+ +
1300+
1301+
Returns idp usage statistics since a given date. Idp statistics can be grouped, allowed options are: none, day, month, total.
1302+
It is also possible to control whether all-zero records in the requested time range should be included or not with the
1303+
+skipZeroRecords+ option, accepting +true+ (the default) and +false+ values.
1304+
1305+
Example output without any grouping applied:
1306+
1307+
----
1308+
[
1309+
{
1310+
"idpId":"endpoint-id",
1311+
"idpName":"Endpoint name",
1312+
"clientId":"clientId1",
1313+
"clientName":"Client Name",
1314+
"sigInStats":[
1315+
{
1316+
"periodStart":"2021-10-21T15:14:09Z",
1317+
"periodEnd":"2021-10-21T15:15:09Z",
1318+
"totatCount":1,
1319+
"successfullCount":1,
1320+
"failedCount":0
1321+
}
1322+
]
1323+
}
1324+
]
1325+
----

engine-api/src/main/java/pl/edu/icm/unity/engine/api/EntityManagement.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Date;
99
import java.util.List;
1010
import java.util.Map;
11+
import java.util.Set;
1112

1213
import pl.edu.icm.unity.exceptions.EngineException;
1314
import pl.edu.icm.unity.types.authn.CredentialRequirements;
@@ -152,12 +153,11 @@ void scheduleEntityChange(EntityParam toChange, Date changeTime, EntityScheduled
152153

153154

154155
/**
155-
* Returns information about an entity along with its all identities. Search by
156-
* verifiable email assigned to the entity.
156+
* Returns entities with assigned e-mail - as attribute or identity
157157
*
158158
* @param contactEmail email assigned to the entity
159159
*/
160-
Entity getEntityByContactEmail(String contactEmail) throws EngineException;
160+
Set<Entity> getAllEntitiesWithContactEmail(String contactEmail) throws EngineException;
161161

162162
/**
163163
* Returns a collection with all groups where the entity is a member. For convenience returned

engine-api/src/main/java/pl/edu/icm/unity/engine/api/GroupsManagement.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pl.edu.icm.unity.types.basic.AttributesClass;
1414
import pl.edu.icm.unity.types.basic.EntityParam;
1515
import pl.edu.icm.unity.types.basic.Group;
16+
import pl.edu.icm.unity.types.basic.GroupsChain;
1617
import pl.edu.icm.unity.types.basic.GroupContents;
1718

1819

@@ -111,5 +112,11 @@ void addMemberFromParent(String path, EntityParam entity,
111112
* Updates the group and pass information: changed property and new value used for audit log only
112113
*/
113114
void updateGroup(String path, Group group, String changedProperty, String newValue) throws EngineException;
115+
116+
117+
/**
118+
* @return GroupChain for given group
119+
*/
120+
GroupsChain getGroupsChain(String path) throws EngineException;
114121
}
115122

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
3+
* See LICENCE.txt file for licensing information.
4+
*/
5+
6+
package pl.edu.icm.unity.engine.api;
7+
8+
import java.time.LocalDateTime;
9+
import java.util.List;
10+
11+
import pl.edu.icm.unity.engine.api.idp.statistic.GroupedIdpStatistic;
12+
import pl.edu.icm.unity.exceptions.EngineException;
13+
import pl.edu.icm.unity.types.basic.idpStatistic.IdpStatistic;
14+
15+
public interface IdpStatisticManagement
16+
{
17+
public static final int DEFAULT_STAT_SIZE_LIMIT = Integer.MAX_VALUE;
18+
public static final int DEFAULT_SIG_IN_RECORD_LIMIT = 100000;
19+
20+
public enum GroupBy
21+
{
22+
none, day, month, total
23+
};
24+
25+
List<IdpStatistic> getIdpStatisticsSince(LocalDateTime since, int limit) throws EngineException;
26+
27+
void deleteOlderThan(LocalDateTime olderThan) throws EngineException;
28+
29+
void addIdpStatistic(IdpStatistic toAdd) throws EngineException;
30+
31+
List<GroupedIdpStatistic> getIdpStatisticsSinceGroupBy(LocalDateTime since, GroupBy groupBy, int sigInlimit,
32+
boolean skipZeroRecords) throws EngineException;
33+
34+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
3+
* See LICENCE.txt file for licensing information.
4+
*/
5+
6+
package pl.edu.icm.unity.engine.api.attributes;
7+
8+
import java.util.Map;
9+
import java.util.stream.Collectors;
10+
import java.util.stream.Stream;
11+
12+
public enum AttributeStatementMVELContextKey
13+
{
14+
idsByType(AttributeStatementMVELContextKey.descriptionPrefix + "idsByType"),
15+
attrs(AttributeStatementMVELContextKey.descriptionPrefix + "attrs"),
16+
attr(AttributeStatementMVELContextKey.descriptionPrefix + "attr"),
17+
eattrs(AttributeStatementMVELContextKey.descriptionPrefix + "eattrs"),
18+
eattr(AttributeStatementMVELContextKey.descriptionPrefix + "eattr"),
19+
groupName(AttributeStatementMVELContextKey.descriptionPrefix + "groupName"),
20+
groups(AttributeStatementMVELContextKey.descriptionPrefix + "groups"),
21+
groupsObj(AttributeStatementMVELContextKey.descriptionPrefix + "groupsObj"),
22+
entityId(AttributeStatementMVELContextKey.descriptionPrefix + "entityId");
23+
24+
public static final String descriptionPrefix = "AttributeStatementMVELContextKey.";
25+
public final String descriptionKey;
26+
27+
private AttributeStatementMVELContextKey(String descriptionKey)
28+
{
29+
this.descriptionKey = descriptionKey;
30+
}
31+
32+
public static Map<String, String> toMap()
33+
{
34+
return Stream.of(values()).collect(Collectors.toMap(v -> v.name(), v -> v.descriptionKey));
35+
}
36+
37+
}

engine-api/src/main/java/pl/edu/icm/unity/engine/api/authn/remote/AuthenticationTriggeringContext.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package pl.edu.icm.unity.engine.api.authn.remote;
66

77
import pl.edu.icm.unity.engine.api.authn.PartialAuthnState;
8+
import pl.edu.icm.unity.engine.api.authn.sandbox.SandboxAuthnEvent;
89
import pl.edu.icm.unity.engine.api.authn.sandbox.SandboxAuthnRouter;
910
import pl.edu.icm.unity.types.authn.AuthenticationOptionKey;
1011
import pl.edu.icm.unity.types.registration.RegistrationForm;
@@ -32,13 +33,13 @@ private AuthenticationTriggeringContext(boolean rememberMeSet,
3233
this.authenticationOptionKey = authenticationOptionKey;
3334
}
3435

35-
public static AuthenticationTriggeringContext registrationTriggeredAuthn(RegistrationForm form,
36-
String invitationCode,
37-
AuthenticationOptionKey authenticationOptionKey)
36+
public static AuthenticationTriggeringContext registrationTriggeredAuthn(RegistrationForm form,
37+
String invitationCode, AuthenticationOptionKey authenticationOptionKey)
3838
{
3939
if (form == null)
4040
throw new IllegalArgumentException("Form must be set in registration triggered remote authn");
41-
return new AuthenticationTriggeringContext(false, null, form, invitationCode, null, authenticationOptionKey);
41+
return new AuthenticationTriggeringContext(false, null, form, invitationCode, new MockSandboxAuthnRouter(),
42+
authenticationOptionKey);
4243
}
4344

4445

@@ -90,4 +91,22 @@ public String toString()
9091
"AuthenticationTriggeringContext [rememberMeSet=%s, firstFactorAuthnState=%s, form=%s, invitationCode=%s]",
9192
rememberMeSet, firstFactorAuthnState, form, invitationCode);
9293
}
94+
95+
private static final class MockSandboxAuthnRouter implements SandboxAuthnRouter
96+
{
97+
@Override
98+
public void addListener(AuthnResultListener listener)
99+
{
100+
}
101+
102+
@Override
103+
public void removeListener(AuthnResultListener listener)
104+
{
105+
}
106+
107+
@Override
108+
public void fireEvent(SandboxAuthnEvent event)
109+
{
110+
}
111+
}
93112
}

engine-api/src/main/java/pl/edu/icm/unity/engine/api/authn/sandbox/SandboxAuthenticationResult.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package pl.edu.icm.unity.engine.api.authn.sandbox;
66

77
import pl.edu.icm.unity.engine.api.authn.AuthenticationResult;
8+
import pl.edu.icm.unity.engine.api.authn.RemoteAuthenticationResult;
89

910
public class SandboxAuthenticationResult implements AuthenticationResult
1011
{
@@ -66,5 +67,11 @@ public String toString()
6667
return baseResult.toString();
6768
}
6869

70+
@Override
71+
public RemoteAuthenticationResult asRemote()
72+
{
73+
return baseResult.asRemote();
74+
}
75+
6976

7077
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
3+
* See LICENCE.txt file for licensing information.
4+
*/
5+
6+
package pl.edu.icm.unity.engine.api.bulkops;
7+
8+
import java.util.Map;
9+
import java.util.stream.Collectors;
10+
import java.util.stream.Stream;
11+
12+
public enum EntityMVELContextKey
13+
{
14+
idsByType(EntityMVELContextKey.descriptionPrefix + "idsByType"),
15+
idsByTypeObj(EntityMVELContextKey.descriptionPrefix + "idsByTypeObj"),
16+
attrs(EntityMVELContextKey.descriptionPrefix + "attrs"),
17+
attr(EntityMVELContextKey.descriptionPrefix + "attr"),
18+
groups(EntityMVELContextKey.descriptionPrefix + "groups"),
19+
status(EntityMVELContextKey.descriptionPrefix + "status"),
20+
credReq(EntityMVELContextKey.descriptionPrefix + "credReq"),
21+
credStatus(EntityMVELContextKey.descriptionPrefix + "credStatus");
22+
23+
public static final String descriptionPrefix = "EntityMVELContextKey.";
24+
public final String descriptionKey;
25+
26+
private EntityMVELContextKey(String descriptionKey)
27+
{
28+
this.descriptionKey = descriptionKey;
29+
}
30+
31+
32+
public static Map<String, String> toMap()
33+
{
34+
return Stream.of(values()).collect(Collectors.toMap(v -> v.name(), v -> v.descriptionKey));
35+
}
36+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
3+
* See LICENCE.txt file for licensing information.
4+
*/
5+
6+
package pl.edu.icm.unity.engine.api.endpoint;
7+
8+
import java.util.Optional;
9+
10+
import pl.edu.icm.unity.exceptions.EngineException;
11+
import pl.edu.icm.unity.types.endpoint.EndpointConfiguration;
12+
13+
public interface EndpointFileConfigurationManagement
14+
{
15+
16+
EndpointConfiguration getEndpointConfig(String name) throws EngineException;
17+
18+
Optional<String> getEndpointConfigKey(String endpointName);
19+
20+
}

0 commit comments

Comments
 (0)